diff options
author | root <root> | 2010-01-08 09:29:56 +0000 |
---|---|---|
committer | root <root> | 2010-01-08 09:29:56 +0000 |
commit | 7c861655219773edb2b8a9323dbbd3d74ee8c3df (patch) | |
tree | 759e9277e25c924c395d323d31e583e9d1ba0ce6 | |
parent | b24913bdea04b6809a76e5976d533289d584741a (diff) |
*** empty log message ***
-rw-r--r-- | eio.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -921,9 +921,10 @@ eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self) off_t sbytes; res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0); - /* freebsd' sendfile will return 0 when success */ - if (res == 0 && sbytes) - /* maybe only on EAGAIN: as usual, the manpage leaves you guessing */ + /* freebsd' sendfile will return 0 on success */ + /* freebsd 8 documents it as only setting *sbytes on EINTR and EAGAIN, but */ + /* not on e.g. EIO or EPIPE - sounds broken */ + if ((res < 0 && (errno == EAGAIN || errno == EINTR) && sbytes) || res == 0) res = sbytes; } @@ -933,7 +934,8 @@ eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self) off_t sbytes = count; res = sendfile (ifd, ofd, offset, &sbytes, 0, 0); - if (res == 0 && errno == EAGAIN && sbytes) + /* according to the manpage, sbytes is always valid */ + if (sbytes) res = sbytes; } |