]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make EALREADY a non-fatal errno for write(). Move check into ignoreErrno().
authorwessels <>
Fri, 24 Oct 1997 02:41:13 +0000 (02:41 +0000)
committerwessels <>
Fri, 24 Oct 1997 02:41:13 +0000 (02:41 +0000)
src/comm.cc

index 6b7bd412a6d0556c094afaadd868f07d7cc553ab..725ad42b51d29b4d4edee858f379aae54fd11f67 100644 (file)
@@ -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;
+}