[PATCH] unzip: -d should create the dir

Lauri Kasanen cand at gmx.com
Wed Apr 15 12:01:44 UTC 2020


The official Info-Zip unzip creates the dir if it doesn't exist.

Signed-off-by: Lauri Kasanen <cand at gmx.com>
---
 archival/unzip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/archival/unzip.c b/archival/unzip.c
index 8c4cb98..45e0727 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -646,8 +646,10 @@ int unzip_main(int argc, char **argv)
 	}

 	/* Change dir if necessary */
-	if (base_dir)
+	if (base_dir) {
+		mkdir(base_dir, 0777); /* Try to create, errors don't matter */
 		xchdir(base_dir);
+	}

 	if (quiet <= 1) { /* not -qq */
 		if (quiet == 0) {
--
2.6.2



More information about the busybox mailing list