Replace usages of sigwait(3) with sigwaitinfo(2)

This is basically the same call, but it has the advantage of being
supported by FreeBSD's valgrind, which sigwait() is not.

References #1106.
This commit is contained in:
Tobias Brunner
2015-10-29 15:38:37 +01:00
parent c6aa606a65
commit 858148092d
9 changed files with 31 additions and 36 deletions
+5 -3
View File
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <signal.h>
#include <pthread.h>
#include <errno.h>
#include <library.h>
#include <hydra.h>
@@ -84,9 +85,10 @@ static int run()
{
int sig;
if (sigwait(&set, &sig))
sig = sigwaitinfo(&set, NULL);
if (sig == -1)
{
DBG1(DBG_DMN, "error while waiting for a signal");
DBG1(DBG_DMN, "waiting for signal failed: %s", strerror(errno));
return 1;
}
switch (sig)
@@ -206,7 +208,7 @@ int main(int argc, char *argv[])
VERSION, utsname.sysname, utsname.release, utsname.machine);
/* add handler for SEGV and ILL,
* INT, TERM and HUP are handled by sigwait() in run() */
* INT, TERM and HUP are handled by sigwaitinfo() in run() */
action.sa_handler = segv_handler;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);