[BusyBox] Bug in tar
Glenn McGrath
bug1 at optushome.com.au
Sat Jan 20 00:13:50 UTC 2001
Francois-R Boyer wrote:
>
> Pipes are not handled correctly when using 'tar -zx...'. Each process
> should close the file handle that is not used, like this:
> if (child_pid==0) {
> /* child process */
> close(unzip_pipe[0]);
> gunzip_init();
> unzip(tarFd, unzip_pipe[1]);
> exit(EXIT_SUCCESS);
> }
> else
> {
> close(unzip_pipe[1]);
> /* return fd of uncompressed data to parent process */
> return(unzip_pipe[0]);
> }
> That way, read and write on the pipe will correctly return with an error if
> the other end of the pipe is closed, and the "signal(SIGCHLD, child_died);"
> patch is not needed.
>
> Francois
>
Thanks for the tip, i hadnt used pipes much prior to writing that code,
at the time i thought closing the handle to the other end of the pipe
would close the pipe, but of course its handled by the other process
then.
Ive updated tar in cvs to do as you suggested.
Thanks
Glenn
More information about the busybox
mailing list