sigwaitinfo() may fail with EINTR if interrupted by an unblocked signal not in the set
Fixes #1213.
This commit is contained in:
+5
-6
@@ -98,7 +98,7 @@ static void run()
|
||||
{
|
||||
sigset_t set;
|
||||
|
||||
/* handle SIGINT, SIGHUP ans SIGTERM in this handler */
|
||||
/* handle SIGINT, SIGHUP and SIGTERM in this handler */
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGINT);
|
||||
sigaddset(&set, SIGHUP);
|
||||
@@ -112,6 +112,10 @@ static void run()
|
||||
sig = sigwaitinfo(&set, NULL);
|
||||
if (sig == -1)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
{ /* ignore signals we didn't wait for */
|
||||
continue;
|
||||
}
|
||||
DBG1(DBG_DMN, "waiting for signal failed: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
@@ -144,11 +148,6 @@ static void run()
|
||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DBG1(DBG_DMN, "unknown signal %d received. Ignored", sig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user