This is the mail archive of the libc-alpha@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]

Re: [PATCH] Assume that O_CLOEXEC is always defined and works


On 04/17/2017 09:11 PM, Adhemerval Zanella wrote:
    if (!do_cloexec)
-#ifdef O_CLOEXEC
      /* Undo the effects of the pipe2 call which set the
         close-on-exec flag.  */
      __fcntl (parent_end, F_SETFD, 0);
-#endif

Why can't we issue the __pipe2 as '__pipe2 (pipe_fds, do_cloexec ? O_CLOEXEC : 0)'
and get rid of this logic here?

There are two descriptors. The descriptor for the subprocess must always be O_CLOEXEC in the parent, so that it's not captured by a concurrent fork and inherited across execve there.

Thanks,
Florian


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