unzip: -d should create the dir
authorLauri Kasanen <cand@gmx.com>
Wed, 15 Apr 2020 12:01:44 +0000 (15:01 +0300)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 29 Apr 2020 12:37:21 +0000 (14:37 +0200)
The official Info-Zip unzip creates the dir if it doesn't exist.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
archival/unzip.c

index 8c4cb9881bf565184490c5a8126f4fd1a65c8ad3..d94bbabcf72b7e11dee3e1c0bc699490abfd2d0b 100644 (file)
@@ -646,8 +646,14 @@ int unzip_main(int argc, char **argv)
        }
 
        /* Change dir if necessary */
-       if (base_dir)
+       if (base_dir) {
+               /* -p DIR: try to create, errors don't matter.
+                * UnZip 6.00 does no multi-level mkdir (-p DIR1/DIR2 syntax),
+                * not using bb_make_directory() here (yet?)
+                */
+               mkdir(base_dir, 0777);
                xchdir(base_dir);
+       }
 
        if (quiet <= 1) { /* not -qq */
                if (quiet == 0) {