From cbdb3cf9be7f0fb5a94e78c3f6fcd22805a57fab Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 10 Aug 2015 13:44:12 +0100 Subject: [PATCH] not quite posted: check for error return before EINTR --- ChangeLog | 3 +++ Src/Modules/socket.c | 2 +- Src/Modules/tcp.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 909507cc6..4153f6a86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-08-10 Peter Stephenson + * not quite posted: Src/Modules/socket.c, Src/Modules/tcp.c: + check for error return before testing for EINTR. + * Joshua Krusell: 36039: Src/Modules/socket.c, Src/Modules/tcp.c: Restart socket commands on EINTR. diff --git a/Src/Modules/socket.c b/Src/Modules/socket.c index 92d0a5035..65b87d7dd 100644 --- a/Src/Modules/socket.c +++ b/Src/Modules/socket.c @@ -193,7 +193,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) len = sizeof(soun); do { rfd = accept(lfd, (struct sockaddr *)&soun, &len); - } while (errno == EINTR && !errflag); + } while (rfd < 0 && errno == EINTR && !errflag); if (rfd == -1) { zwarnnam(nam, "could not accept connection: %e", errno); diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c index 304927313..bc1765da1 100644 --- a/Src/Modules/tcp.c +++ b/Src/Modules/tcp.c @@ -538,7 +538,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) len = sizeof(sess->peer.in); do { rfd = accept(lfd, (struct sockaddr *)&sess->peer.in, &len); - } while (errno == EINTR && !errflag); + } while (rfd < 0 && errno == EINTR && !errflag); if (rfd == -1) { zwarnnam(nam, "could not accept connection: %e", errno);