]> git.cworth.org Git - gzip/blobdiff - gzip.c
Imported Debian patch 1.3.5-14
[gzip] / gzip.c
diff --git a/gzip.c b/gzip.c
index a72cb201b0a4831ce11827c2b35c04f5b2b8d21d..bfab6e74b96f0e0f7a55a558a8c247b9cd14f914 100644 (file)
--- 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