summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/bbunzip.c8
-rw-r--r--archival/libunarchive/data_extract_all.c6
-rw-r--r--coreutils/touch.c9
-rw-r--r--libbb/copy_file.c6
4 files changed, 18 insertions, 11 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index f81aab8..22a0fd1 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -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 */
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 889face..294024b 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)
}
/* 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);
}
}
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 7d1bf0d..f670b7f 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -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;
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index a96691b..adcfe21 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)
/* 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);