Fwd: eio.c bug - use of errno without testing result
schmorp at schmorp.de
Fri Oct 29 15:30:58 CEST 2010
On Fri, Oct 29, 2010 at 02:40:51AM -0700, Liam <libev at networkimprov.net> wrote:
> The issue is... because sendfile(2) on Linux and FreeBSD succeed but set an
> erroneous errno, an app which simply checks the eio req->errorno to decide
> if there's an error may fail. Node.js does this as it provides callbacks
> with either an error or data, never both.
Then node.js is horribly broken on any OS, with any syscall, not just
> Since eio is supports multiple OSes, one might expect it to hide OS
It works like any other syscall actually, no syscall clears errno, node.js is
simply broken if it uses errno to test for failure.
To test for failure, one has to check the return value of the call. errno
only tells you _how_ something failed, not _whether_ something failed.
And that's the same for any syscall on any OS.
It would be rather eccentric if it did, in fact :)
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
More information about the libev