On Fri, Aug 3, 2018 at 11:09 PM, Tobias Schramm <[email protected]> wrote:
> Moving the destination fd first ensures it is never overwritten even
> if it is fd 0.
>
> Signed-off-by: Tobias Schramm <[email protected]>
> ---
>  archival/tar.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/archival/tar.c b/archival/tar.c
> index ae1ccc756..94793977c 100644
> --- a/archival/tar.c
> +++ b/archival/tar.c
> @@ -623,8 +623,8 @@ static void NOINLINE vfork_compressor(int tar_fd, const 
> char *gzip)
>                  * parent waits for this close to happen */
>                 fcntl(gzipStatusPipe.wr, F_SETFD, FD_CLOEXEC);
>  #  endif
> -               xmove_fd(gzipDataPipe.rd, 0);
>                 xmove_fd(tar_fd, 1);
> +               xmove_fd(gzipDataPipe.rd, 0);

Well, yes, old code was trashing tar_fd if tar_fd was 0.

Now, new code would misbehave if gzipDataPipe.rd was 1, right?

Instead, I added code which additionally moves tar_fd if it was 0.
Please try current git.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to