From 9728f535e27548925b93981662844b3a2fe7dbfa Mon Sep 17 00:00:00 2001 From: Joshua Krusell Date: Mon, 10 Aug 2015 12:22:12 +0200 Subject: 36039: Restart socket commands on EINTR --- Src/Modules/tcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Src/Modules/tcp.c') 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; -- cgit v1.2.3