From cb9090dc93b093b513c9799137286a225b473528 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 23 May 2013 02:07:55 +0200 Subject: [PATCH] esl: Don't abort the esl_listen() loop(s) if accept() returns with errno == EINTR ivrd doesn't use sigaction + SA_RESTART for SIGCHILD. An exiting child process will interrupt accept() in the parent to handle the signal, which makes accept() return -1 (errno = EINTR) after the sighandler function returns. Signed-off-by: Stefan Knoblich --- libs/esl/src/esl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 103f9156c9..0da5fd2509 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -696,7 +696,7 @@ ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_list clntLen = sizeof(echoClntAddr); - if ((client_sock = accept(server_sock, (struct sockaddr *) &echoClntAddr, &clntLen)) == ESL_SOCK_INVALID) { + if ((client_sock = accept(server_sock, (struct sockaddr *) &echoClntAddr, &clntLen)) == ESL_SOCK_INVALID && errno != EINTR) { status = ESL_FAIL; goto end; } @@ -754,7 +754,7 @@ ESL_DECLARE(esl_status_t) esl_listen_threaded(const char *host, esl_port_t port, clntLen = sizeof(echoClntAddr); - if ((client_sock = accept(server_sock, (struct sockaddr *) &echoClntAddr, &clntLen)) == ESL_SOCK_INVALID) { + if ((client_sock = accept(server_sock, (struct sockaddr *) &echoClntAddr, &clntLen)) == ESL_SOCK_INVALID && errno != EINTR) { status = ESL_FAIL; goto end; }