This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] support: Close original descriptors in support_capture_subprocess
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Sat, 01 Dec 2018 15:50:51 +0100
- Subject: Re: [PATCH] support: Close original descriptors in support_capture_subprocess
- References: <87muppo5hp.fsf@oldenburg.str.redhat.com>
On Dez 01 2018, Florian Weimer <fweimer@redhat.com> wrote:
> 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]);
Is there any reason pipe would have handed out 0, 1 or 2?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."