some non-gnu compilers can't have non-const struct initializers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a307af1af6
commit
389cca4b9e
@ -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, ×); /* ignoring errors */
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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, ×) < 0)
|
||||
bb_perror_msg("can't preserve %s of '%s'", "times", dest);
|
||||
|
Loading…
Reference in New Issue
Block a user