summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/bbunzip.c8
-rw-r--r--archival/libunarchive/data_extract_all.c8
-rw-r--r--coreutils/touch.c12
-rw-r--r--libbb/copy_file.c8
4 files changed, 18 insertions, 18 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 22a0fd1..df674bc 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -105,15 +105,15 @@ int FAST_FUNC bbunpack(char **argv,
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, &times); /* ignoring errors */
+ utimes(new_name, times); /* ignoring errors */
}
/* Delete _compressed_ file */
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 1100410..ae242df 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -148,11 +148,11 @@ 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;
+ 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);
}
}
}
diff --git a/coreutils/touch.c b/coreutils/touch.c
index f670b7f..be2d2f9 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -54,8 +54,8 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
# 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
@@ -84,7 +84,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
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) {
@@ -100,11 +100,11 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
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;
@@ -115,7 +115,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
);
if ((fd >= 0) && !close(fd)) {
if (reference_file)
- utimes(*argv, &timebuf);
+ utimes(*argv, timebuf);
continue;
}
}
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index adcfe21..893b52e 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -374,12 +374,12 @@ 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;
+ 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, &times) < 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);