This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 3/3] posix: New Linux posix_spawn{p} implementation
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Rasmus Villemoes <rv at rasmusvillemoes dot dk>
- Cc: <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Date: Wed, 31 Aug 2016 22:08:13 +0000
- Subject: Re: [PATCH v2 3/3] posix: New Linux posix_spawn{p} implementation
- Authentication-results: sourceware.org; auth=none
- References: <1454343665-1706-1-git-send-email-adhemerval.zanella@linaro.org> <1454343665-1706-4-git-send-email-adhemerval.zanella@linaro.org> <87mvjsprqb.fsf@rasmusvillemoes.dk>
On Wed, 31 Aug 2016, Rasmus Villemoes wrote:
> Rather late to the party, but I think there's a few bugs here. Most
> importantly, dup() doesn't preserve the CLOEXEC flag, so if we do move
> the write end around like this, the fd will not automatically be closed
> during the exec, and hence the parent won't receive EOF and will block
> in read() call until the child finally exits. That's easily fixable with
> fcntl(p, F_DUPFD_CLOEXEC, 0). Pretty annoying to add a test for, though.
In Linux-specific code we can assume the presence of dup3 (which needs to
be called by the name __dup3 in implementations of POSIX functions).
--
Joseph S. Myers
joseph@codesourcery.com