From: wessels <> Date: Fri, 24 Oct 1997 02:41:13 +0000 (+0000) Subject: Make EALREADY a non-fatal errno for write(). Move check into ignoreErrno(). X-Git-Tag: SQUID_3_0_PRE1~4728 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=26a880e2a46ab86fa59fbd802ec4b52503e94842;p=thirdparty%2Fsquid.git Make EALREADY a non-fatal errno for write(). Move check into ignoreErrno(). --- diff --git a/src/comm.cc b/src/comm.cc index 6b7bd412a6..725ad42b51 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.191 1997/10/23 16:38:09 wessels Exp $ + * $Id: comm.cc,v 1.192 1997/10/23 20:41:13 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -156,6 +156,7 @@ static int fdIsHttpOrIcp _PARAMS((int fd)); static IPH commConnectDnsHandle; static void commConnectCallback _PARAMS((ConnectStateData * cs, int status)); static int commDeferRead(int fd); +static int ignoreErrno(int errno); static struct timeval zero_tv; @@ -1318,7 +1319,7 @@ commHandleWrite(int fd, void *data) CommWriteStateCallbackAndFree(fd, nleft ? COMM_ERROR : COMM_OK); } else if (len < 0) { /* An error */ - if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) { + if (ignoreErrno(errno)) { debug(50, 10) ("commHandleWrite: FD %d: write failure: %s.\n", fd, xstrerror()); commSetSelect(fd, @@ -1373,3 +1374,19 @@ comm_write(int fd, char *buf, int size, CWCB * handler, void *handler_data, FREE fd_table[fd].rwstate, 0); } + +static int +ignoreErrno(int errno) +{ + if (errno == EWOULDBLOCK) + return 1; +#if EAGAIN != EWOULDBLOCK + if (errno == EAGAIN) + return 1; +#endif + if (errno == EALREADY) + return 1; + if (errno == EINTR) + return 1; + return 0; +}