From 1d269432b16b77e78544cf2b7aae04f0e4b8c06c Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Sat, 20 Jan 2001 00:12:21 +0000 Subject: Close unused pipe handle before fork (for tar -z). --- archival/tar.c | 5 ++++- tar.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/archival/tar.c b/archival/tar.c index 844559580..49e99a1a5 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -169,13 +169,16 @@ extern int tar_unzip_init(int tarFd) if (child_pid==0) { /* child process */ + close(unzip_pipe[0]); gunzip_init(); unzip(tarFd, unzip_pipe[1]); exit(EXIT_SUCCESS); } - else + else { /* return fd of uncompressed data to parent process */ + close(unzip_pipe[1]); return(unzip_pipe[0]); + } } #endif diff --git a/tar.c b/tar.c index 844559580..49e99a1a5 100644 --- a/tar.c +++ b/tar.c @@ -169,13 +169,16 @@ extern int tar_unzip_init(int tarFd) if (child_pid==0) { /* child process */ + close(unzip_pipe[0]); gunzip_init(); unzip(tarFd, unzip_pipe[1]); exit(EXIT_SUCCESS); } - else + else { /* return fd of uncompressed data to parent process */ + close(unzip_pipe[1]); return(unzip_pipe[0]); + } } #endif -- cgit v1.2.3