}
/* same for utime */
if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) {
- struct utimbuf t;
- t.actime = t.modtime = file_header->mtime;
- utime(file_header->name, &t);
+ struct timeval t = {.tv_sec = file_header->mtime,
+ .tv_usec = 0};
+ utimes(file_header->name, &t);
}
}
}
"date\0" Required_argument "d"
;
# endif
- struct utimbuf timebuf;
+ struct timeval timebuf = {.tv_usec = 0};
char *reference_file = NULL;
char *date_str = NULL;
#else
# define reference_file NULL
# define date_str NULL
-# define timebuf (*(struct utimbuf*)NULL)
+# define timebuf (*(struct timeval*)NULL)
#endif
int fd;
int status = EXIT_SUCCESS;
if (reference_file) {
struct stat stbuf;
xstat(reference_file, &stbuf);
- timebuf.actime = stbuf.st_atime;
- timebuf.modtime = stbuf.st_mtime;
+ timebuf.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.actime = t;
- timebuf.modtime = t;
+ timebuf.tv_sec = t;
}
do {
- if (utime(*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)
- utime(*argv, &timebuf);
+ utimes(*argv, &timebuf);
continue;
}
}
/* Cannot happen: */
/* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */
) {
- struct utimbuf times;
-
- times.actime = source_stat.st_atime;
- times.modtime = source_stat.st_mtime;
+ struct timeval times = {.tv_sec = source_stat.st_mtime,
+ .tv_usec = 0};
/* BTW, utimes sets usec-precision time - just FYI */
- if (utime(dest, ×) < 0)
+ if (utimes(dest, ×) < 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);
# don't allow obsolete functions
#
find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
- grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes|sigblock|siggetmask|sigsetmask)\>[[:space:]]*\(' \
+ grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utime|sigblock|siggetmask|sigsetmask)\>[[:space:]]*\(' \
| sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs
testing "Obsolete function usage" "cat src.obsolete.funcs" "" "" ""
rm -f src.obsolete.funcs