Re: svn commit: r291114 - head/lib/libc/gen

2015-11-21 Thread Andrey Chernov
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

Re: svn commit: r291114 - head/lib/libc/gen

2015-11-20 Thread Ravi Pokala
-Original Message- From: Andrey Chernov <a...@freebsd.org> Date: 2015-11-20, Friday at 15:20 To: Ravi Pokala <rpok...@freebsd.org>, <src-committ...@freebsd.org>, <svn-src-...@freebsd.org>, <svn-src-head@freebsd.org> Subject: Re: svn commit: r291114 - head/

Re: svn commit: r291114 - head/lib/libc/gen

2015-11-20 Thread Andrey Chernov
On 21.11.2015 2:57, Ravi Pokala wrote: > There's two different things at play - userland resources and kernel > resources. Both "FILE *iop" and "struct pid *cur" are userland, while the > descriptors in "pdes" are kernel. We clean up the descriptors in "pdes" in > call cases, so we're not

svn commit: r291114 - head/lib/libc/gen

2015-11-20 Thread Ravi Pokala
Author: rpokala Date: Fri Nov 20 22:36:41 2015 New Revision: 291114 URL: https://svnweb.freebsd.org/changeset/base/291114 Log: popen() requires check for fdopen() failure Move fdopen() up near other resource allocation like malloc(); do proper deallocation on failure later on in the

Re: svn commit: r291114 - head/lib/libc/gen

2015-11-20 Thread Andrey Chernov
On 21.11.2015 1:36, Ravi Pokala wrote: > Move fdopen() up near other resource allocation like malloc(); do proper > deallocation on failure later on in the function. Incorrect. Old code calls fdopen() only in the parent, new one calls fdopen() before fork(), so its results shared by both

Re: svn commit: r291114 - head/lib/libc/gen

2015-11-20 Thread Andrey Chernov
On 21.11.2015 2:20, Andrey Chernov wrote: > On 21.11.2015 1:36, Ravi Pokala wrote: >> Move fdopen() up near other resource allocation like malloc(); do proper >> deallocation on failure later on in the function. > > Incorrect. Old code calls fdopen() only in the parent, new one calls >

Re: svn commit: r291114 - head/lib/libc/gen

2015-11-20 Thread David Sanderson
On Fri, Nov 20, 2015 at 7:08 PM, Andrey Chernov wrote: > On 21.11.2015 2:57, Ravi Pokala wrote: > > There's two different things at play - userland resources and kernel > resources. Both "FILE *iop" and "struct pid *cur" are userland, while the > descriptors in "pdes" are