[PATCH] [xorg/xserver] os/client: Prevent rare fd leak in DetermineClientPid

Erkki Seppala erkki.seppala at vincit.fi
Fri Mar 25 01:37:07 PDT 2011


On 24.03.2011 19:31, Keith Packard wrote:
> On Thu, 24 Mar 2011 15:18:17 +0100 (CET), Mark
> Kettenis<mark.kettenis at xs4all.nl>  wrote:
>
>> Actually, checking the return value of close(2) is fairly silly,
>> at least in this context.  So you could write this as:
>
> Yeah, what error are they looking for here?

No particular reason I imagine, other than being a good citizen and
checking return values of system calls ;). A simplifying patch follows. 
In fact, it's the very same code as Mark suggested ;).

(I actually considered "if (close(fd) < 0 || totsize <= 0) return;"
as well, but disregarded it for being slightly obscure.)


More information about the xorg-devel mailing list