unix: set errno in sendfile emulation

The sendfile emulation in src/unix/fs.c polls the file descriptor for
write readiness. If POLLERR or POLLHUP is set, it bails out but doesn't
set errno (hence it doesn't report a useful error code). Rectify that.

Fixes #620.
This commit is contained in:
Ben Noordhuis 2013-02-25 03:22:10 +01:00
parent b04fc33ef7
commit 39c8a90a91

View File

@ -374,6 +374,7 @@ static ssize_t uv__fs_sendfile_emul(uv_fs_t* req) {
while (n == -1 && errno == EINTR);
if (n == -1 || (pfd.revents & ~POLLOUT) != 0) {
errno = EIO;
nsent = -1;
goto out;
}