aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-25 20:54:45 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-25 20:54:45 +0000
commita04cc47f1c53c34e81a7271d687d8b68d0489892 (patch)
tree1325f2bb5ae82f1417bc3a9e5682adc1cee71c38
parent6e18f9a6ea8e0c6f00eb8276744bdc3889b64c76 (diff)
downloadbusybox-w32-a04cc47f1c53c34e81a7271d687d8b68d0489892.tar.gz
busybox-w32-a04cc47f1c53c34e81a7271d687d8b68d0489892.tar.bz2
busybox-w32-a04cc47f1c53c34e81a7271d687d8b68d0489892.zip
b[un]zip2, g[un]zip: unlink destination if -f is given. Closes 3854
-rw-r--r--archival/bbunzip.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 90d39f682..09a4eb9eb 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -73,6 +73,12 @@ int bbunpack(char **argv,
73 bb_error_msg("%s: unknown suffix - ignored", filename); 73 bb_error_msg("%s: unknown suffix - ignored", filename);
74 goto err; 74 goto err;
75 } 75 }
76
77 /* -f: overwrite existing output files */
78 if (option_mask32 & OPT_FORCE) {
79 unlink(new_name);
80 }
81
76 /* O_EXCL: "real" bunzip2 doesn't overwrite files */ 82 /* O_EXCL: "real" bunzip2 doesn't overwrite files */
77 /* GNU gunzip does not bail out, but goes to next file */ 83 /* GNU gunzip does not bail out, but goes to next file */
78 if (open_to_or_warn(STDOUT_FILENO, new_name, O_WRONLY | O_CREAT | O_EXCL, 84 if (open_to_or_warn(STDOUT_FILENO, new_name, O_WRONLY | O_CREAT | O_EXCL,