From: Paul Eggert Date: Mon, 4 Dec 2006 09:06:11 +0000 (+0100) Subject: install.c: Preserve time stamps before changing owner or file mode bits, X-Git-Tag: COREUTILS-6_7~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8406e92795b8cfce52651ec663aece6b451740aa;p=thirdparty%2Fcoreutils.git install.c: Preserve time stamps before changing owner or file mode bits, for consistency with other coreutils programs. --- diff --git a/ChangeLog b/ChangeLog index 7fa9809cb6..551668c0f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-12-03 Paul Eggert + + * src/install.c (install_file_in_file): Preserve time stamps + before changing owner or file mode bits, for consistency with + other coreutils programs. + 2006-12-03 Jim Meyering * tests/misc/date-sec: Output a fixed string. diff --git a/src/install.c b/src/install.c index 1ccc7749cd..a5d832f861 100644 --- a/src/install.c +++ b/src/install.c @@ -459,11 +459,10 @@ install_file_in_file (const char *from, const char *to, return false; if (strip_files) strip (to); - if (! change_attributes (to)) + if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode)) + && ! change_timestamps (&from_sb, to)) return false; - if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode))) - return change_timestamps (&from_sb, to); - return true; + return change_attributes (to); } /* Copy file FROM into directory TO_DIR, keeping its same name,