commit 4ab1e4067371b9fe802f8aac0e0c021338a35e71
parent 4b11319b7961aa6fefdc4e96be36642a9cd74335
Author: sin <sin@2f30.org>
Date: Thu, 2 Jun 2016 18:32:37 +0100
Don't die on EINTR in accept()
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/ncmixer.c b/ncmixer.c
@@ -253,8 +253,11 @@ loop(void)
if (pfd[CH0_LISTEN].revents & POLLIN) {
len = sizeof(sun);
clifd = accept(pfd[CH0_LISTEN].fd, (SA *)&sun, &len);
- if (clifd == -1)
- err(1, "accept");
+ if (clifd == -1) {
+ if (errno != EINTR)
+ err(1, "accept");
+ continue;
+ }
if (pfd[CH0_CLIENT].fd == -1) {
pfd[CH0_CLIENT].fd = clifd;
pfd[CH0_CLIENT].events = POLLIN;
@@ -268,8 +271,11 @@ loop(void)
if (pfd[CH1_LISTEN].revents & POLLIN) {
len = sizeof(sun);
clifd = accept(pfd[CH1_LISTEN].fd, (SA *)&sun, &len);
- if (clifd == -1)
- err(1, "accept");
+ if (clifd == -1) {
+ if (errno != EINTR)
+ err(1, "accept");
+ continue;
+ }
if (pfd[CH1_CLIENT].fd == -1) {
pfd[CH1_CLIENT].fd = clifd;
pfd[CH1_CLIENT].events = POLLIN;