diff options
author | Joshua Krusell <js.shirin@gmail.com> | 2015-08-10 12:22:12 +0200 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-08-10 12:32:33 +0100 |
commit | 9728f535e27548925b93981662844b3a2fe7dbfa (patch) | |
tree | 8384f3d5ca894d796c19dcf1f9d6af6f01919eca /Src | |
parent | ade35d3c2689da409fd23029b91fd1327d808291 (diff) | |
download | zsh-9728f535e27548925b93981662844b3a2fe7dbfa.tar.gz zsh-9728f535e27548925b93981662844b3a2fe7dbfa.tar.xz zsh-9728f535e27548925b93981662844b3a2fe7dbfa.zip |
36039: Restart socket commands on EINTR
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Modules/socket.c | 7 | ||||
-rw-r--r-- | Src/Modules/tcp.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/Src/Modules/socket.c b/Src/Modules/socket.c index cd56d4646..92d0a5035 100644 --- a/Src/Modules/socket.c +++ b/Src/Modules/socket.c @@ -191,8 +191,11 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) } len = sizeof(soun); - if ((rfd = accept(lfd, (struct sockaddr *)&soun, &len)) == -1) - { + do { + rfd = accept(lfd, (struct sockaddr *)&soun, &len); + } while (errno == EINTR && !errflag); + + if (rfd == -1) { zwarnnam(nam, "could not accept connection: %e", errno); return 1; } diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c index d5b62a82e..304927313 100644 --- a/Src/Modules/tcp.c +++ b/Src/Modules/tcp.c @@ -536,8 +536,11 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) sess = zts_alloc(ZTCP_INBOUND); len = sizeof(sess->peer.in); - if ((rfd = accept(lfd, (struct sockaddr *)&sess->peer.in, &len)) == -1) - { + do { + rfd = accept(lfd, (struct sockaddr *)&sess->peer.in, &len); + } while (errno == EINTR && !errflag); + + if (rfd == -1) { zwarnnam(nam, "could not accept connection: %e", errno); tcp_close(sess); return 1; |