This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/18433] posix_spawn does not return correctly upon failure to execute


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]