X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gzip.c;fp=gzip.c;h=bfab6e74b96f0e0f7a55a558a8c247b9cd14f914;hb=0161769885b1bdcc3d5f6699ade8f2b88c56e570;hp=a72cb201b0a4831ce11827c2b35c04f5b2b8d21d;hpb=15eea35eec74f226bb721ebf0b3ee7473b1a5ff9;p=gzip diff --git a/gzip.c b/gzip.c index a72cb20..bfab6e7 100644 --- a/gzip.c +++ b/gzip.c @@ -882,10 +882,21 @@ local void treat_file(iname) close(ifd); if (!to_stdout) { - /* Copy modes, times, ownership, and remove the input file */ + /* Copy modes, times, and ownership */ copy_stat(&istat); if (close(ofd)) write_error(); + remove_ofname = 0; + + /* It's now safe to remove the input file: */ + if (xunlink (ifname)) { + int e = errno; + WARN((stderr, "%s: ", progname)); + if (!quiet) { + errno = e; + perror(ifname); + } + } } if (method == -1) { if (!to_stdout) xunlink (ofname); @@ -1745,16 +1756,6 @@ local void copy_stat(ifstat) #ifndef NO_CHOWN fchown(ofd, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */ #endif - remove_ofname = 0; - /* It's now safe to remove the input file: */ - if (xunlink (ifname)) { - int e = errno; - WARN((stderr, "%s: ", progname)); - if (!quiet) { - errno = e; - perror(ifname); - } - } } #if ! NO_DIR