From: Alex Riesen Date: Wed, 27 Jun 2007 12:48:52 GMT Subject: Re: [PATCH] detect dup failure Message-ID: <81b0412b0706270548p6f694fd6x5f47cbefa16c08ac@mail.gmail.com> In-Reply-To: <87wsxpobf0.fsf@rho.meyering.net> On 6/27/07, Jim Meyering wrote: > Without this, if you ever run out of file descriptors, dup will > fail (silently), fdopen will return NULL, and fprintf will > try to dereference NULL (i.e., usually segfault). But if you check the result of fdopen for NULL instead you'll cover the dup failure _and_ out-of-memory in one go. You'll loose the errno (probably), but you don't seem to use it here anyway.