[BusyBox] Bug in tar

Francois-R Boyer boyerf at IRO.UMontreal.CA
Fri Jan 19 06:05:12 UTC 2001


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






More information about the busybox mailing list