(fillcache, do_write, io_input, io_output): Portability fix: always

check both EAGAIN and EWOULDBLOCK.  These are distinct on some
systems, e.g. HP-UX.
(io_output) [hpux]: Used to treat all errors as EWOULDBLOCK.  This
looks like a inept attempt to `fix' the above.  Remove.
This commit is contained in:
Markus Armbruster 2005-11-22 20:28:18 +00:00
parent 9113969208
commit edaa05b8cb
2 changed files with 4 additions and 11 deletions

View file

@ -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);