Close unused pipe handle before fork (for tar -z).
This commit is contained in:
parent
8392acd8fc
commit
1d269432b1
@ -169,13 +169,16 @@ extern int tar_unzip_init(int tarFd)
|
|||||||
|
|
||||||
if (child_pid==0) {
|
if (child_pid==0) {
|
||||||
/* child process */
|
/* child process */
|
||||||
|
close(unzip_pipe[0]);
|
||||||
gunzip_init();
|
gunzip_init();
|
||||||
unzip(tarFd, unzip_pipe[1]);
|
unzip(tarFd, unzip_pipe[1]);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
/* return fd of uncompressed data to parent process */
|
/* return fd of uncompressed data to parent process */
|
||||||
|
close(unzip_pipe[1]);
|
||||||
return(unzip_pipe[0]);
|
return(unzip_pipe[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
5
tar.c
5
tar.c
@ -169,13 +169,16 @@ extern int tar_unzip_init(int tarFd)
|
|||||||
|
|
||||||
if (child_pid==0) {
|
if (child_pid==0) {
|
||||||
/* child process */
|
/* child process */
|
||||||
|
close(unzip_pipe[0]);
|
||||||
gunzip_init();
|
gunzip_init();
|
||||||
unzip(tarFd, unzip_pipe[1]);
|
unzip(tarFd, unzip_pipe[1]);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
/* return fd of uncompressed data to parent process */
|
/* return fd of uncompressed data to parent process */
|
||||||
|
close(unzip_pipe[1]);
|
||||||
return(unzip_pipe[0]);
|
return(unzip_pipe[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user