aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-11-15 00:12:53 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-11-15 00:12:53 +0100
commita307af1af62c51e33e2801d74dbc35560af0fc0e (patch)
tree8d1164763328f7b580afceda831b979de97b7da7 /libbb
parentcc8b6871a71e42a3e0bdb79e534b90cc3eb4c8e6 (diff)
downloadbusybox-w32-a307af1af62c51e33e2801d74dbc35560af0fc0e.tar.gz
busybox-w32-a307af1af62c51e33e2801d74dbc35560af0fc0e.tar.bz2
busybox-w32-a307af1af62c51e33e2801d74dbc35560af0fc0e.zip
use utimes() rather than obsolescent utime()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/copy_file.c8
1 files changed, 3 insertions, 5 deletions
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)
374 /* Cannot happen: */ 374 /* Cannot happen: */
375 /* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */ 375 /* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */
376 ) { 376 ) {
377 struct utimbuf times; 377 struct timeval times = {.tv_sec = source_stat.st_mtime,
378 378 .tv_usec = 0};
379 times.actime = source_stat.st_atime;
380 times.modtime = source_stat.st_mtime;
381 /* BTW, utimes sets usec-precision time - just FYI */ 379 /* BTW, utimes sets usec-precision time - just FYI */
382 if (utime(dest, &times) < 0) 380 if (utimes(dest, &times) < 0)
383 bb_perror_msg("can't preserve %s of '%s'", "times", dest); 381 bb_perror_msg("can't preserve %s of '%s'", "times", dest);
384 if (chown(dest, source_stat.st_uid, source_stat.st_gid) < 0) { 382 if (chown(dest, source_stat.st_uid, source_stat.st_gid) < 0) {
385 source_stat.st_mode &= ~(S_ISUID | S_ISGID); 383 source_stat.st_mode &= ~(S_ISUID | S_ISGID);