This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/18433] posix_spawn does not return correctly upon failure to execute
- From: "rahimi.nv at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sat, 12 Sep 2015 21:00:10 +0000
- Subject: [Bug libc/18433] posix_spawn does not return correctly upon failure to execute
- Auto-submitted: auto-generated
- References: <bug-18433-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18433
--- Comment #5 from navid R <rahimi.nv at gmail dot com> ---
I developed a pipe solution but didn't get accepted in mailing list . The
problem raise because glibc is supporting system without pipe2 , (we can use
pipe for creating file descriptor and use fcntl and FD_CLOEXEC to set it
proper flag , but there is race condition between two calls . and the overall
code is so messy .
#ifdef __ASSUME_PIPE2
if (__pipe2 (pipefd, O_CLOEXEC))
return errno;
#else // FALLBACK mode in systems which does not have pipe2 call
if (__pipe (pipefd))
return errno;
/* <==== here we have race condition ==> */
if (__fcntl (pipefd[0], FD_CLOEXEC) == -1 ||
__fcntl (pipefd[1], FD_CLOEXEC) == -1)
return errno;
With this explanation , I have change of heart , I think vfork solution would
be better .
--
You are receiving this mail because:
You are on the CC list for the bug.