svn commit: trunk/busybox/archival

vda at busybox.net vda at busybox.net
Wed Jun 25 20:54:46 UTC 2008


Author: vda
Date: 2008-06-25 13:54:45 -0700 (Wed, 25 Jun 2008)
New Revision: 22509

Log:
b[un]zip2, g[un]zip: unlink destination if -f is given. Closes 3854



Modified:
   trunk/busybox/archival/bbunzip.c


Changeset:
Modified: trunk/busybox/archival/bbunzip.c
===================================================================
--- trunk/busybox/archival/bbunzip.c	2008-06-25 15:58:00 UTC (rev 22508)
+++ trunk/busybox/archival/bbunzip.c	2008-06-25 20:54:45 UTC (rev 22509)
@@ -73,6 +73,12 @@
 				bb_error_msg("%s: unknown suffix - ignored", filename);
 				goto err;
 			}
+
+			/* -f: overwrite existing output files */
+			if (option_mask32 & OPT_FORCE) {
+				unlink(new_name);
+			}
+
 			/* O_EXCL: "real" bunzip2 doesn't overwrite files */
 			/* GNU gunzip does not bail out, but goes to next file */
 			if (open_to_or_warn(STDOUT_FILENO, new_name, O_WRONLY | O_CREAT | O_EXCL,




More information about the busybox-cvs mailing list