some non-gnu compilers can't have non-const struct initializers
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 15 Nov 2009 01:28:56 +0000 (02:28 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 15 Nov 2009 01:28:56 +0000 (02:28 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
archival/bbunzip.c
archival/libunarchive/data_extract_all.c
coreutils/touch.c
libbb/copy_file.c

index f81aab8..22a0fd1 100644 (file)
@@ -105,10 +105,12 @@ int FAST_FUNC bbunpack(char **argv,
                        if (status >= 0) {
                                /* TODO: restore other things? */
                                if (info.mtime) {
-                                       struct timeval times = {.tv_sec = info.mtime,
-                                                                                       .tv_usec = 0};
+                                       struct timeval times;
+
+                                       times.tv_sec = info.mtime;
+                                       times.tv_usec = 0;
                                        /* Note: we closed it first.
-                                        * On some systems calling utime
+                                        * On some systems calling utimes
                                         * then closing resets the mtime
                                         * back to current time. */
                                        utimes(new_name, &times); /* ignoring errors */
index 889face..294024b 100644 (file)
@@ -143,8 +143,10 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
                }
                /* same for utime */
                if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) {
-                       struct timeval t = {.tv_sec = file_header->mtime,
-                                                               .tv_usec = 0};
+                       struct timeval t;
+
+                       t.tv_sec = file_header->mtime;
+                       t.tv_usec = 0;
                        utimes(file_header->name, &t);
                }
        }
index 7d1bf0d..f670b7f 100644 (file)
@@ -40,6 +40,9 @@
 int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int touch_main(int argc UNUSED_PARAM, char **argv)
 {
+       int fd;
+       int status = EXIT_SUCCESS;
+       int opts;
 #if ENABLE_DESKTOP
 # if ENABLE_LONG_OPTS
        static const char touch_longopts[] ALIGN1 =
@@ -49,17 +52,15 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
                "date\0"              Required_argument "d"
        ;
 # endif
-       struct timeval timebuf = {.tv_usec = 0};
        char *reference_file = NULL;
        char *date_str = NULL;
+       struct timeval timebuf;
+       timebuf.tv_usec = 0;
 #else
 # define reference_file NULL
 # define date_str       NULL
 # define timebuf        (*(struct timeval*)NULL)
 #endif
-       int fd;
-       int status = EXIT_SUCCESS;
-       int opts;
 
 #if ENABLE_DESKTOP && ENABLE_LONG_OPTS
        applet_long_options = touch_longopts;
index a96691b..adcfe21 100644 (file)
@@ -374,8 +374,10 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
        /* Cannot happen: */
        /* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */
        ) {
-               struct timeval times = {.tv_sec = source_stat.st_mtime,
-                                                               .tv_usec = 0};
+               struct timeval times;
+
+               times.tv_sec = source_stat.st_mtime;
+               times.tv_usec = 0;
                /* BTW, utimes sets usec-precision time - just FYI */
                if (utimes(dest, &times) < 0)
                        bb_perror_msg("can't preserve %s of '%s'", "times", dest);