Use BB_EXECVP for better consistency with other applets. Allows for more control over exactly which compressor is used.
The xz compressor is disabled when applets are prefered, since the xz applet does not support compression. Signed-off-by: Nadav Tasher <tasherna...@gmail.com> --- archival/tar.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/archival/tar.c b/archival/tar.c index d6ca6c1e0..67c880e4d 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -575,6 +575,7 @@ static void NOINLINE vfork_compressor(int tar_fd, const char *gzip) // On Linux, vfork never unpauses parent early, although standard // allows for that. Do we want to waste bytes checking for it? # define WAIT_FOR_CHILD 0 + char* gzip_argv[] = { (char *) gzip, (char *) "-f", NULL }; volatile int vfork_exec_errno = 0; struct fd_pair data; # if WAIT_FOR_CHILD @@ -614,11 +615,17 @@ static void NOINLINE vfork_compressor(int tar_fd, const char *gzip) xmove_fd(tfd, 1); /* exec gzip/bzip2/... program */ - //BB_EXECLP(gzip, gzip, "-f", (char *)0); - WRONG for "xz", + +# if ENABLE_FEATURE_PREFER_APPLETS // if xz is an enabled applet, it'll be a version which // can only decompress. We do need to execute external // program, not applet. - execlp(gzip, gzip, "-f", (char *)0); + if (strncmp(gzip, "xz", 2)) + _exit_FAILURE(); +# endif + + // This works for all other compressions + BB_EXECVP(gzip, gzip_argv); vfork_exec_errno = errno; _exit_FAILURE(); -- 2.43.0 _______________________________________________ busybox mailing list busybox@busybox.net https://lists.busybox.net/mailman/listinfo/busybox