Bug 601: When we fork an archiver and feed stuff to it through a pipe, if
authorRob Landley <rob@landley.net>
Fri, 16 Dec 2005 21:33:10 +0000 (21:33 -0000)
committerRob Landley <rob@landley.net>
Fri, 16 Dec 2005 21:33:10 +0000 (21:33 -0000)
we don't close the pipe the child process won't exit, and we'll hang in
waitpid().

archival/tar.c

index b2967463e4d5ad5ce9329eeeaa260333e5e0ecae..cd89a7566de17b91c25ad613bfb51d17fcca498a 100644 (file)
@@ -513,11 +513,12 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
         * but that isn't necessary for GNU tar interoperability, and
         * so is considered a waste of space */
 
+       /* Close so the child process (if any) will exit */
+       close(tbInfo.tarFd);
+
        /* Hang up the tools, close up shop, head home */
-       if (ENABLE_FEATURE_CLEAN_UP) {
-               close(tbInfo.tarFd);
+       if (ENABLE_FEATURE_CLEAN_UP)
                freeHardLinkInfo(&tbInfo.hlInfoHead);
-       }
 
        if (errorFlag)
                bb_error_msg("Error exit delayed from previous errors");