if (status >= 0) {
/* TODO: restore other things? */
if (info.mtime) {
- struct timeval times;
+ struct timeval times[2];
- times.tv_sec = info.mtime;
- times.tv_usec = 0;
+ times[1].tv_sec = times[0].tv_sec = info.mtime;
+ times[1].tv_usec = times[0].tv_usec = 0;
/* Note: we closed it first.
* On some systems calling utimes
* then closing resets the mtime
* back to current time. */
- utimes(new_name, ×); /* ignoring errors */
+ utimes(new_name, times); /* ignoring errors */
}
/* Delete _compressed_ file */
}
/* same for utime */
if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) {
- struct timeval t;
+ struct timeval t[2];
- t.tv_sec = file_header->mtime;
- t.tv_usec = 0;
- utimes(file_header->name, &t);
+ t[1].tv_sec = t[0].tv_sec = file_header->mtime;
+ t[1].tv_usec = t[0].tv_usec = 0;
+ utimes(file_header->name, t);
}
}
}
# endif
char *reference_file = NULL;
char *date_str = NULL;
- struct timeval timebuf;
- timebuf.tv_usec = 0;
+ struct timeval timebuf[2];
+ timebuf[1].tv_usec = timebuf[0].tv_usec = 0;
#else
# define reference_file NULL
# define date_str NULL
if (reference_file) {
struct stat stbuf;
xstat(reference_file, &stbuf);
- timebuf.tv_sec = stbuf.st_mtime;
+ timebuf[1].tv_sec = timebuf[0].tv_sec = stbuf.st_mtime;
}
if (date_str) {
tm_time.tm_isdst = -1; /* Be sure to recheck dst */
t = validate_tm_time(date_str, &tm_time);
- timebuf.tv_sec = t;
+ timebuf[1].tv_sec = timebuf[0].tv_sec = t;
}
do {
- if (utimes(*argv, reference_file ? &timebuf : NULL)) {
+ if (utimes(*argv, reference_file ? timebuf : NULL)) {
if (errno == ENOENT) { /* no such file */
if (opts) { /* creation is disabled, so ignore */
continue;
);
if ((fd >= 0) && !close(fd)) {
if (reference_file)
- utimes(*argv, &timebuf);
+ utimes(*argv, timebuf);
continue;
}
}
/* Cannot happen: */
/* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */
) {
- struct timeval times;
+ struct timeval times[2];
- times.tv_sec = source_stat.st_mtime;
- times.tv_usec = 0;
+ times[1].tv_sec = times[0].tv_sec = source_stat.st_mtime;
+ times[1].tv_usec = times[0].tv_usec = 0;
/* BTW, utimes sets usec-precision time - just FYI */
- if (utimes(dest, ×) < 0)
+ if (utimes(dest, times) < 0)
bb_perror_msg("can't preserve %s of '%s'", "times", dest);
if (chown(dest, source_stat.st_uid, source_stat.st_gid) < 0) {
source_stat.st_mode &= ~(S_ISUID | S_ISGID);