From patchwork Sat Dec 1 11:23:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 30505 Received: (qmail 47005 invoked by alias); 1 Dec 2018 11:23:43 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 46995 invoked by uid 89); 1 Dec 2018 11:23:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, TVD_SPACE_RATIO autolearn=ham version=3.3.2 spammy=closure, Hx-languages-length:807 X-HELO: mx1.redhat.com From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] support: Close original descriptors in support_capture_subprocess Date: Sat, 01 Dec 2018 12:23:30 +0100 Message-ID: <87muppo5hp.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 2018-12-01 Florian Weimer * support/support_capture_subprocess.c (support_capture_subprocess): Close original pipe descriptors in subprocess. diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c index 6d2029e13b..e1efcd52b0 100644 --- a/support/support_capture_subprocess.c +++ b/support/support_capture_subprocess.c @@ -72,6 +72,10 @@ support_capture_subprocess (void (*callback) (void *), void *closure) xclose (stderr_pipe[0]); xdup2 (stdout_pipe[1], STDOUT_FILENO); xdup2 (stderr_pipe[1], STDERR_FILENO); + if (stdout_pipe[1] > STDERR_FILENO) + xclose (stdout_pipe[1]); + if (stderr_pipe[1] > STDERR_FILENO) + xclose (stderr_pipe[1]); callback (closure); _exit (0); }