From: wessels <> Date: Sat, 15 Nov 1997 00:21:15 +0000 (+0000) Subject: Use new ignoreErrno() X-Git-Tag: SQUID_3_0_PRE1~4531 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b224ea981232ab66c46fdd2ca76c1910a1bef26e;p=thirdparty%2Fsquid.git Use new ignoreErrno() --- diff --git a/src/comm.cc b/src/comm.cc index 6c1d0b4540..bc14d01dd8 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.203 1997/11/14 04:55:06 wessels Exp $ + * $Id: comm.cc,v 1.204 1997/11/14 17:21:15 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -158,7 +158,6 @@ static int fdIsHttpOrIcp(int fd); static IPH commConnectDnsHandle; static void commConnectCallback(ConnectStateData * cs, int status); static int commDeferRead(int fd); -static int ignoreErrno(int); static void commSetConnectTimeout(int fd, time_t timeout); static int commResetFD(ConnectStateData * cs); static int commRetryConnect(ConnectStateData * cs); @@ -1391,7 +1390,7 @@ comm_write(int fd, char *buf, int size, CWCB * handler, void *handler_data, FREE 0); } -static int +int ignoreErrno(int ierrno) { if (ierrno == EWOULDBLOCK) diff --git a/src/disk.cc b/src/disk.cc index 905781a9ad..71a0a9d68e 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,5 +1,6 @@ + /* - * $Id: disk.cc,v 1.94 1997/11/14 04:55:07 wessels Exp $ + * $Id: disk.cc,v 1.95 1997/11/14 17:21:17 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -280,9 +281,7 @@ diskHandleWriteComplete(void *data, int len, int errcode) if (q == NULL) /* Someone aborted then write completed */ return; if (len < 0) { - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { - (void) 0; - } else { + if (!ignoreErrno(errno)) { status = errno == ENOSPC ? DISK_NO_SPACE_LEFT : DISK_ERROR; debug(50, 1) ("diskHandleWrite: FD %d: disk write error: %s\n", fd, xstrerror()); @@ -415,7 +414,7 @@ diskHandleReadComplete(void *data, int len, int errcode) xfree(data); fd_bytes(fd, len, FD_READ); if (len < 0) { - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, diskHandleRead, ctrl_dat, 0); return; } diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 7f967a547e..f4f08f69e9 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.66 1997/11/12 00:08:50 wessels Exp $ + * $Id: fqdncache.cc,v 1.67 1997/11/14 17:21:17 wessels Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -537,7 +537,7 @@ fqdncache_dnsHandleRead(int fd, void *data) debug(35, 5) ("fqdncache_dnsHandleRead: Result from DNS ID %d (%d bytes)\n", dnsData->id, len); if (len <= 0) { - if (len < 0 && (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN)) { + if (len < 0 && ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, fqdncache_dnsHandleRead, diff --git a/src/ftp.cc b/src/ftp.cc index fcea09c35c..b4941d8480 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,5 +1,5 @@ /* - * $Id: ftp.cc,v 1.168 1997/11/12 22:50:22 wessels Exp $ + * $Id: ftp.cc,v 1.169 1997/11/14 17:21:18 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -686,7 +686,7 @@ ftpReadData(int fd, void *data) } if (len < 0) { debug(50, 1) ("ftpReadData: read error: %s\n", xstrerror()); - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, ftpReadData, data, Config.Timeout.read); } else { if (mem->inmem_hi == 0) { @@ -1022,7 +1022,7 @@ ftpReadControlReply(int fd, void *data) debug(9, 5) ("ftpReadControlReply: FD %d, Read %d bytes\n", fd, len); if (len < 0) { debug(50, 1) ("ftpReadControlReply: read error: %s\n", xstrerror()); - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, ftpReadControlReply, diff --git a/src/gopher.cc b/src/gopher.cc index 31af70e483..4c91f6a421 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,6 +1,6 @@ /* - * $Id: gopher.cc,v 1.112 1997/11/12 00:08:51 wessels Exp $ + * $Id: gopher.cc,v 1.113 1997/11/14 17:21:19 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -689,13 +689,8 @@ gopherReadReply(int fd, void *data) } if (len < 0) { debug(50, 1) ("gopherReadReply: error reading: %s\n", xstrerror()); - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { - /* reinstall handlers */ - /* XXX This may loop forever */ - commSetSelect(fd, - COMM_SELECT_READ, - gopherReadReply, - data, 0); + if (ignoreErrno(errno)) { + commSetSelect(fd, COMM_SELECT_READ, gopherReadReply, data, 0); } else { /* was assert */ ErrorState *err; diff --git a/src/http.cc b/src/http.cc index 4ccd4b8196..9caf8bce9b 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.221 1997/11/12 18:58:41 wessels Exp $ + * $Id: http.cc,v 1.222 1997/11/14 17:21:20 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -627,7 +627,7 @@ httpReadReply(int fd, void *data) IOStats.Http.read_hist[bin]++; } if (len < 0) { - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0); } else { if (clen == 0) { diff --git a/src/icmp.cc b/src/icmp.cc index 81d727775f..388002fc21 100644 --- a/src/icmp.cc +++ b/src/icmp.cc @@ -1,6 +1,6 @@ /* - * $Id: icmp.cc,v 1.49 1997/11/12 23:47:38 wessels Exp $ + * $Id: icmp.cc,v 1.50 1997/11/14 17:21:21 wessels Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -136,7 +136,7 @@ icmpSend(int fd, void *data) queue->len, 0); if (x < 0) { - if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) + if (ignoreErrno(errno)) break; /* don't de-queue */ debug(50, 0) ("icmpSend: send: %s\n", xstrerror()); if (errno == ECONNREFUSED) { diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 88f76af358..68f0354fb6 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -47,7 +47,7 @@ icpUdpReply(int fd, void *data) queue->msg, queue->len); if (x < 0) { - if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) + if (ignoreErrno(errno)) break; /* don't de-queue */ } UdpQueueHead = queue->next; @@ -189,7 +189,7 @@ icpCheckUdpHit(StoreEntry * e, request_t * request) int icpCheckUdpHitObj(StoreEntry * e, request_t * r, icp_common_t * h, int len) { - if (!(h->flags & ICP_FLAG_HIT_OBJ)) /* not requested */ + if (!(h->flags & ICP_FLAG_HIT_OBJ)) /* not requested */ return 0; if (len > Config.udpMaxHitObjsz) /* too big */ return 0; diff --git a/src/ipcache.cc b/src/ipcache.cc index 73fa0d9545..0a4b122cf6 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.142 1997/11/12 00:08:55 wessels Exp $ + * $Id: ipcache.cc,v 1.143 1997/11/14 17:21:22 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -580,7 +580,7 @@ ipcache_dnsHandleRead(int fd, void *data) debug(14, 5) ("ipcache_dnsHandleRead: Result from DNS ID %d (%d bytes)\n", dnsData->id, len); if (len <= 0) { - if (len < 0 && (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)) { + if (len < 0 && ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, ipcache_dnsHandleRead, @@ -742,7 +742,7 @@ ipcache_dnsDispatch(dnsserver_t * dns, ipcache_entry * i) assert(i->status == IP_PENDING); buf = xcalloc(1, 256); snprintf(buf, 256, "%s\n", i->name); - EBIT_SET(dns->flags , HELPER_BUSY); + EBIT_SET(dns->flags, HELPER_BUSY); dns->data = i; i->status = IP_DISPATCHED; comm_write(dns->outpipe, diff --git a/src/protos.h b/src/protos.h index 52588334e5..18b3eb6f88 100644 --- a/src/protos.h +++ b/src/protos.h @@ -103,6 +103,7 @@ extern void comm_write(int fd, extern void commCallCloseHandlers(int fd); extern int commSetTimeout(int fd, int, PF *, void *); extern void commSetDefer(int fd, DEFER * func, void *); +extern int ignoreErrno(int); extern void _db_init(const char *logfile, const char *options); extern void _db_rotate_log(void); @@ -551,4 +552,4 @@ extern int pconnPop(const char *host, u_short port); extern void pconnInit(void); extern int asnMatchIp(void *, struct in_addr); -extern void asnAclInitialize (acl *); +extern void asnAclInitialize(acl *); diff --git a/src/ssl.cc b/src/ssl.cc index 88d26be5b6..8e6efc6436 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.71 1997/11/12 23:47:40 wessels Exp $ + * $Id: ssl.cc,v 1.72 1997/11/14 17:21:23 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -120,7 +120,7 @@ sslReadServer(int fd, void *data) if (len < 0) { debug(50, 1) ("sslReadServer: FD %d: read failure: %s\n", sslState->server.fd, xstrerror()); - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { /* reinstall handlers */ /* XXX This may loop forever */ commSetSelect(sslState->server.fd, @@ -162,7 +162,7 @@ sslReadClient(int fd, void *data) if (len < 0) { debug(50, 1) ("sslReadClient: FD %d: read failure: %s\n", fd, xstrerror()); - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { /* reinstall handlers */ /* XXX This may loop forever */ commSetSelect(sslState->client.fd, @@ -197,7 +197,7 @@ sslWriteServer(int fd, void *data) fd_bytes(fd, len, FD_WRITE); debug(26, 5) ("sslWriteServer FD %d, wrote %d bytes\n", fd, len); if (len < 0) { - if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) { + if (ignoreErrno(errno)) { commSetSelect(sslState->server.fd, COMM_SELECT_WRITE, sslWriteServer, @@ -244,7 +244,7 @@ sslWriteClient(int fd, void *data) fd_bytes(fd, len, FD_WRITE); debug(26, 5) ("sslWriteClient FD %d, wrote %d bytes\n", fd, len); if (len < 0) { - if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) { + if (ignoreErrno(errno)) { commSetSelect(sslState->client.fd, COMM_SELECT_WRITE, sslWriteClient, diff --git a/src/tunnel.cc b/src/tunnel.cc index af265b5889..6a6d9dcf2b 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.71 1997/11/12 23:47:40 wessels Exp $ + * $Id: tunnel.cc,v 1.72 1997/11/14 17:21:23 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -120,7 +120,7 @@ sslReadServer(int fd, void *data) if (len < 0) { debug(50, 1) ("sslReadServer: FD %d: read failure: %s\n", sslState->server.fd, xstrerror()); - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { /* reinstall handlers */ /* XXX This may loop forever */ commSetSelect(sslState->server.fd, @@ -162,7 +162,7 @@ sslReadClient(int fd, void *data) if (len < 0) { debug(50, 1) ("sslReadClient: FD %d: read failure: %s\n", fd, xstrerror()); - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { /* reinstall handlers */ /* XXX This may loop forever */ commSetSelect(sslState->client.fd, @@ -197,7 +197,7 @@ sslWriteServer(int fd, void *data) fd_bytes(fd, len, FD_WRITE); debug(26, 5) ("sslWriteServer FD %d, wrote %d bytes\n", fd, len); if (len < 0) { - if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) { + if (ignoreErrno(errno)) { commSetSelect(sslState->server.fd, COMM_SELECT_WRITE, sslWriteServer, @@ -244,7 +244,7 @@ sslWriteClient(int fd, void *data) fd_bytes(fd, len, FD_WRITE); debug(26, 5) ("sslWriteClient FD %d, wrote %d bytes\n", fd, len); if (len < 0) { - if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) { + if (ignoreErrno(errno)) { commSetSelect(sslState->client.fd, COMM_SELECT_WRITE, sslWriteClient, diff --git a/src/wais.cc b/src/wais.cc index e3f55ef3a1..523a0fcbb5 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,6 +1,6 @@ /* - * $Id: wais.cc,v 1.97 1997/11/12 00:09:13 wessels Exp $ + * $Id: wais.cc,v 1.98 1997/11/14 17:21:24 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -186,7 +186,7 @@ waisReadReply(int fd, void *data) } if (len < 0) { debug(50, 1) ("waisReadReply: FD %d: read failure: %s.\n", xstrerror()); - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if (ignoreErrno(errno)) { /* reinstall handlers */ /* XXX This may loop forever */ commSetSelect(fd, COMM_SELECT_READ,