aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-29 19:40:36 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-29 19:40:36 +0100
commitdcbfaba264df2f9f07e53f77e8178f5bfc7ae88e (patch)
treeb5dfaa3715ded4f3c9a676b6cf636ad50bf04c9d /libbb
parentbf22475e9552b08feb31d40250ab293d2fd98234 (diff)
downloadbusybox-w32-dcbfaba264df2f9f07e53f77e8178f5bfc7ae88e.tar.gz
busybox-w32-dcbfaba264df2f9f07e53f77e8178f5bfc7ae88e.tar.bz2
busybox-w32-dcbfaba264df2f9f07e53f77e8178f5bfc7ae88e.zip
fix improper utimes usage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/copy_file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index adcfe2111..893b52ed5 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)
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 timeval times; 377 struct timeval times[2];
378 378
379 times.tv_sec = source_stat.st_mtime; 379 times[1].tv_sec = times[0].tv_sec = source_stat.st_mtime;
380 times.tv_usec = 0; 380 times[1].tv_usec = times[0].tv_usec = 0;
381 /* BTW, utimes sets usec-precision time - just FYI */ 381 /* BTW, utimes sets usec-precision time - just FYI */
382 if (utimes(dest, &times) < 0) 382 if (utimes(dest, times) < 0)
383 bb_perror_msg("can't preserve %s of '%s'", "times", dest); 383 bb_perror_msg("can't preserve %s of '%s'", "times", dest);
384 if (chown(dest, source_stat.st_uid, source_stat.st_gid) < 0) { 384 if (chown(dest, source_stat.st_uid, source_stat.st_gid) < 0) {
385 source_stat.st_mode &= ~(S_ISUID | S_ISGID); 385 source_stat.st_mode &= ~(S_ISUID | S_ISGID);