[PATCH] ev: fix epoll_init fd leak

Jonathan Neuschäfer j.neuschaefer at gmx.net
Mon Oct 31 21:07:39 CET 2011


On Mon, Oct 31, 2011 at 06:52:15PM +0100, Marc Lehmann wrote:
> On Mon, Oct 31, 2011 at 11:10:56AM +0100, Ben Noordhuis <info at bnoordhuis.nl> wrote:
> > stick on conventions like always checking for < 0 on error instead of <= 0,
> > as, in fact, epoll_create returns -1 (< 0) on error, and never 0, as 0 is -
> > in fact - a valid file descriptor.
> 
> 0 is, in fact, not a valid file descriptor in this case, as it is stdin,
> and an epoll fd is not having the properties stdin has - althoguh it'S
> much betterto have an epoll fd there than, say, your shadow file :)

As this is not exactly the same as checking for a simple error, I think
this line needs a comment why it checks for <= 0 and not < 0.

--
Jonathan Neuschäfer



More information about the libev mailing list