[PATCH] unzip: -d should create the dir

Johannes Schindelin Johannes.Schindelin at gmx.de
Fri Apr 17 22:23:13 UTC 2020


Hi,

On Wed, 15 Apr 2020, Lauri Kasanen wrote:

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

This bit me recently, too. However,

> 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 */

Doesn't Info-Zip do more like an `mkdir -p` than only a single level?

Ciao,
Johannes

>  		xchdir(base_dir);
> +	}
>
>  	if (quiet <= 1) { /* not -qq */
>  		if (quiet == 0) {
> --
> 2.6.2
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>


More information about the busybox mailing list