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, ×); /* ignoring errors */
}
/* 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);
}
}
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 =
"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;
/* 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, ×) < 0)
bb_perror_msg("can't preserve %s of '%s'", "times", dest);