joyent/libuv — pull request #670 by saghul (2012-12-27 22:22:54+00:00)
Title: unix: Reset errno when using sendfile emulation

Here is a case I ran into while testing uv_cancel and fs operations: when a fs request is cancelled req->result will not be set and thus it will have the initial value, that is, 0. So, (please correct me if I'm wrong), the proper way to see if a request failed would be to see if req->errorno is != 0.

Then, when sendfile is used, if it fails but the emulation succeeds req->errorno will be set to ENOTSOCK for example, even if the request succeeded.

/cc @bnoordhuis