diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c index 8711a20c2354..ac98fe5e084f 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