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 <stkn@openisdn.net>
This commit is contained in:
Stefan Knoblich 2013-05-23 02:07:55 +02:00
parent ca1d407921
commit cb9090dc93
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}