From 39c8a90a91211d047fa3c267814e17d5c10cc83c Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 25 Feb 2013 03:22:10 +0100 Subject: [PATCH] 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. --- src/unix/fs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/fs.c b/src/unix/fs.c index f9181df1..53f46ce7 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -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; }