From a307af1af62c51e33e2801d74dbc35560af0fc0e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 15 Nov 2009 00:12:53 +0100 Subject: use utimes() rather than obsolescent utime() Signed-off-by: Bernhard Reutner-Fischer --- libbb/copy_file.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'libbb/copy_file.c') diff --git a/libbb/copy_file.c b/libbb/copy_file.c index ff298855d..a96691b24 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c @@ -374,12 +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 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); -- cgit v1.2.3