diff options
author | rwatson <rwatson@FreeBSD.org> | 2008-03-09 11:16:42 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2008-03-09 11:16:42 +0000 |
commit | d006593fca9fa75d6c9fc7c029068a8fa455e350 (patch) | |
tree | d2d7677c9844b0590b1aae5d5eee25094a913835 /usr.bin/gzip | |
parent | 160b9af7de7a81553546fd33255be6d51d647fed (diff) | |
download | FreeBSD-src-d006593fca9fa75d6c9fc7c029068a8fa455e350.zip FreeBSD-src-d006593fca9fa75d6c9fc7c029068a8fa455e350.tar.gz |
When gzipping to a target file, only set the source file flags on the
target file after the timestamp has been set; otherwise setting the
timestamp will fail if the flags don't permit it (i.e., uchg).
MFC after: 1 week
PR: 120208
Submitted by: Ighighi <ighighi at gmail.com>
Diffstat (limited to 'usr.bin/gzip')
-rw-r--r-- | usr.bin/gzip/gzip.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c index 8711a20..ac98fe5 100644 --- a/usr.bin/gzip/gzip.c +++ b/usr.bin/gzip/gzip.c @@ -1075,14 +1075,14 @@ copymodes(int fd, const struct stat *sbp, const char *file) if (fchmod(fd, sb.st_mode) < 0) maybe_warn("couldn't fchmod: %s", file); - /* only try flags if they exist already */ - if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0) - maybe_warn("couldn't fchflags: %s", file); - TIMESPEC_TO_TIMEVAL(×[0], &sb.st_atimespec); TIMESPEC_TO_TIMEVAL(×[1], &sb.st_mtimespec); if (futimes(fd, times) < 0) maybe_warn("couldn't utimes: %s", file); + + /* only try flags if they exist already */ + if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0) + maybe_warn("couldn't fchflags: %s", file); } #endif |