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

Andrey Chernov ache at freebsd.org
Fri Nov 20 23:55:32 UTC 2015


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
> fdopen() before fork(), so its results shared by both parent and child,
> which is wrong for child() case.
> 

To be specific, fdopen() may set FD_CLOEXEC for the _child_, for
example. I don't have a time right now to check what happens in that
case, but it looks suspicious.

IMHO it will be better to add fdopen() error processing in the parent,
leaving fdopen() where it was.

-- 
http://ache.vniz.net/


More information about the svn-src-all mailing list