diff --git a/src/lib/common/file.c b/src/lib/common/file.c index fdba22b2..9781ad9b 100644 --- a/src/lib/common/file.c +++ b/src/lib/common/file.c @@ -276,7 +276,7 @@ fillcache(struct empfile *ep, int start) while (n > 0) { ret = read(ep->fd, p, n); if (ret < 0) { - if (errno != EAGAIN) { + if (errno != EAGAIN && errno != EWOULDBLOCK) { logerror("Error reading %s (%s)", ep->file, strerror(errno)); break; } @@ -319,7 +319,7 @@ do_write(struct empfile *ep, void *buf, int id, int count) while (n > 0) { ret = write(ep->fd, p, n); if (ret < 0) { - if (errno != EAGAIN) { + if (errno != EAGAIN && errno != EWOULDBLOCK) { logerror("Error writing %s (%s)", ep->file, strerror(errno)); /* FIXME if this extended file, truncate back to old size */ return -1; diff --git a/src/lib/gen/io.c b/src/lib/gen/io.c index 207ec956..f99f5561 100644 --- a/src/lib/gen/io.c +++ b/src/lib/gen/io.c @@ -147,7 +147,7 @@ io_input(struct iop *iop, int waitforinput) cc = read(iop->fd, buf, sizeof(buf)); if (cc < 0) { /* would block, so nothing to read. */ - if (errno == EWOULDBLOCK) + if (errno == EAGAIN || errno == EWOULDBLOCK) return 0; /* Some form of file error occurred... */ @@ -243,7 +243,7 @@ io_output(struct iop *iop, int waitforoutput) /* if it failed.... */ if (cc < 0) { /* Hmm, it would block. file is opened noblock, soooooo.. */ - if (errno == EWOULDBLOCK) { + if (errno == EAGAIN || errno == EWOULDBLOCK) { /* If there are remaining bytes, set the IO as remaining.. */ remain = ioq_qsize(iop->output); return remain; @@ -269,17 +269,10 @@ io_output(struct iop *iop, int waitforoutput) #endif /* If no bytes were written, something happened.. Like an EOF. */ -#ifndef hpux if (cc == 0) { iop->flags |= IO_EOF; return 0; } -#else - if (cc == 0) { - remain = ioq_qsize(iop->output); - return remain; - } -#endif /* hpux */ /* Remove the number of written bytes from the queue. */ ioq_dequeue(iop->output, cc);