diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-15 02:28:56 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-15 02:28:56 +0100 |
commit | 389cca4b9ed07be8d873b2aae01f3eb0c3474f7c (patch) | |
tree | 4ec81672d1bd6b18578576b876659d6a257ca5ae | |
parent | a307af1af62c51e33e2801d74dbc35560af0fc0e (diff) | |
download | busybox-w32-389cca4b9ed07be8d873b2aae01f3eb0c3474f7c.tar.gz busybox-w32-389cca4b9ed07be8d873b2aae01f3eb0c3474f7c.tar.bz2 busybox-w32-389cca4b9ed07be8d873b2aae01f3eb0c3474f7c.zip |
some non-gnu compilers can't have non-const struct initializers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/bbunzip.c | 8 | ||||
-rw-r--r-- | archival/libunarchive/data_extract_all.c | 6 | ||||
-rw-r--r-- | coreutils/touch.c | 9 | ||||
-rw-r--r-- | libbb/copy_file.c | 6 |
4 files changed, 18 insertions, 11 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index f81aab81f..22a0fd189 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -105,10 +105,12 @@ int FAST_FUNC bbunpack(char **argv, | |||
105 | if (status >= 0) { | 105 | if (status >= 0) { |
106 | /* TODO: restore other things? */ | 106 | /* TODO: restore other things? */ |
107 | if (info.mtime) { | 107 | if (info.mtime) { |
108 | struct timeval times = {.tv_sec = info.mtime, | 108 | struct timeval times; |
109 | .tv_usec = 0}; | 109 | |
110 | times.tv_sec = info.mtime; | ||
111 | times.tv_usec = 0; | ||
110 | /* Note: we closed it first. | 112 | /* Note: we closed it first. |
111 | * On some systems calling utime | 113 | * On some systems calling utimes |
112 | * then closing resets the mtime | 114 | * then closing resets the mtime |
113 | * back to current time. */ | 115 | * back to current time. */ |
114 | utimes(new_name, ×); /* ignoring errors */ | 116 | utimes(new_name, ×); /* ignoring errors */ |
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c index 889face10..294024bbb 100644 --- a/archival/libunarchive/data_extract_all.c +++ b/archival/libunarchive/data_extract_all.c | |||
@@ -143,8 +143,10 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) | |||
143 | } | 143 | } |
144 | /* same for utime */ | 144 | /* same for utime */ |
145 | if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) { | 145 | if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) { |
146 | struct timeval t = {.tv_sec = file_header->mtime, | 146 | struct timeval t; |
147 | .tv_usec = 0}; | 147 | |
148 | t.tv_sec = file_header->mtime; | ||
149 | t.tv_usec = 0; | ||
148 | utimes(file_header->name, &t); | 150 | utimes(file_header->name, &t); |
149 | } | 151 | } |
150 | } | 152 | } |
diff --git a/coreutils/touch.c b/coreutils/touch.c index 7d1bf0d9e..f670b7f6e 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -40,6 +40,9 @@ | |||
40 | int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 40 | int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
41 | int touch_main(int argc UNUSED_PARAM, char **argv) | 41 | int touch_main(int argc UNUSED_PARAM, char **argv) |
42 | { | 42 | { |
43 | int fd; | ||
44 | int status = EXIT_SUCCESS; | ||
45 | int opts; | ||
43 | #if ENABLE_DESKTOP | 46 | #if ENABLE_DESKTOP |
44 | # if ENABLE_LONG_OPTS | 47 | # if ENABLE_LONG_OPTS |
45 | static const char touch_longopts[] ALIGN1 = | 48 | static const char touch_longopts[] ALIGN1 = |
@@ -49,17 +52,15 @@ int touch_main(int argc UNUSED_PARAM, char **argv) | |||
49 | "date\0" Required_argument "d" | 52 | "date\0" Required_argument "d" |
50 | ; | 53 | ; |
51 | # endif | 54 | # endif |
52 | struct timeval timebuf = {.tv_usec = 0}; | ||
53 | char *reference_file = NULL; | 55 | char *reference_file = NULL; |
54 | char *date_str = NULL; | 56 | char *date_str = NULL; |
57 | struct timeval timebuf; | ||
58 | timebuf.tv_usec = 0; | ||
55 | #else | 59 | #else |
56 | # define reference_file NULL | 60 | # define reference_file NULL |
57 | # define date_str NULL | 61 | # define date_str NULL |
58 | # define timebuf (*(struct timeval*)NULL) | 62 | # define timebuf (*(struct timeval*)NULL) |
59 | #endif | 63 | #endif |
60 | int fd; | ||
61 | int status = EXIT_SUCCESS; | ||
62 | int opts; | ||
63 | 64 | ||
64 | #if ENABLE_DESKTOP && ENABLE_LONG_OPTS | 65 | #if ENABLE_DESKTOP && ENABLE_LONG_OPTS |
65 | applet_long_options = touch_longopts; | 66 | applet_long_options = touch_longopts; |
diff --git a/libbb/copy_file.c b/libbb/copy_file.c index a96691b24..adcfe2111 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c | |||
@@ -374,8 +374,10 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags) | |||
374 | /* Cannot happen: */ | 374 | /* Cannot happen: */ |
375 | /* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */ | 375 | /* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */ |
376 | ) { | 376 | ) { |
377 | struct timeval times = {.tv_sec = source_stat.st_mtime, | 377 | struct timeval times; |
378 | .tv_usec = 0}; | 378 | |
379 | times.tv_sec = source_stat.st_mtime; | ||
380 | times.tv_usec = 0; | ||
379 | /* BTW, utimes sets usec-precision time - just FYI */ | 381 | /* BTW, utimes sets usec-precision time - just FYI */ |
380 | if (utimes(dest, ×) < 0) | 382 | if (utimes(dest, ×) < 0) |
381 | bb_perror_msg("can't preserve %s of '%s'", "times", dest); | 383 | bb_perror_msg("can't preserve %s of '%s'", "times", dest); |