Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Nov 2015 02:55:27 +0300
From:      Andrey Chernov <ache@freebsd.org>
To:        Ravi Pokala <rpokala@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r291114 - head/lib/libc/gen
Message-ID:  <564FB2EF.7020302@freebsd.org>
In-Reply-To: <564FAAB0.6000600@freebsd.org>
References:  <201511202236.tAKMaf06048447@repo.freebsd.org> <564FAAB0.6000600@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?564FB2EF.7020302>