On 21.11.2015 5:29, David Sanderson wrote:
> Thank you for pointing out the possibility of fdopen() setting
> FD_CLOEXEC on the parent's end of the pipe if the mode string contains
> an 'e'.  This is indeed documented on popen(3).
> 
> However, note that popen() uses pipe2(pdes, O_CLOEXEC) to create the
> pipe -- so both ends of the pipe start out with FD_CLOEXEC set.
> 
> If the caller uses popen() with "re" or "we", the fdopen() code will
> simply set FD_CLOEXEC on the parent's end of the pipe _again_.  So
> moving the fdopen() prior to the fork() doesn't have any net effect on
> the file descriptors the child process receives, even in the face of
> popen() with "re" or "we".
> 
> Does this address your concerns?

Yes, it is safe in this case. Thanx.

-- 
http://ache.vniz.net/
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to