diff --git a/src/anet.c b/src/anet.c index a121c2768..ee78703c7 100644 --- a/src/anet.c +++ b/src/anet.c @@ -493,17 +493,12 @@ int anetUnixServer(char *err, char *path, mode_t perm, int backlog) static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *len) { int fd; - while(1) { + do { fd = accept(s,sa,len); - if (fd == -1) { - if (errno == EINTR) - continue; - else { - anetSetError(err, "accept: %s", strerror(errno)); - return ANET_ERR; - } - } - break; + } while(fd == -1 && errno == EINTR); + if (fd == -1) { + anetSetError(err, "accept: %s", strerror(errno)); + return ANET_ERR; } return fd; }