summaryrefslogtreecommitdiff
path: root/eio.c
diff options
context:
space:
mode:
authorroot <root>2010-01-08 09:29:56 +0000
committerroot <root>2010-01-08 09:29:56 +0000
commit7c861655219773edb2b8a9323dbbd3d74ee8c3df (patch)
tree759e9277e25c924c395d323d31e583e9d1ba0ce6 /eio.c
parentb24913bdea04b6809a76e5976d533289d584741a (diff)
*** empty log message ***
Diffstat (limited to 'eio.c')
-rw-r--r--eio.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/eio.c b/eio.c
index 0f48a71..383c940 100644
--- a/eio.c
+++ b/eio.c
@@ -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;
}