From 9ad5329913cf99e5498ddff228d5906f9570e28b Mon Sep 17 00:00:00 2001 From: sin Date: Fri, 7 Feb 2014 16:46:16 +0000 Subject: Some more error checking just to be sure --- sinit.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sinit.c b/sinit.c index 35579d7..ce93b19 100644 --- a/sinit.c +++ b/sinit.c @@ -54,10 +54,13 @@ main(void) return EXIT_FAILURE; setsid(); - sigemptyset(&sigset); + if (sigemptyset(&sigset) < 0) + eprintf("sinit: sigemptyset:"); for (i = 0; i < LEN(dispatchsig); i++) - sigaddset(&sigset, dispatchsig[i].sig); - sigprocmask(SIG_BLOCK, &sigset, NULL); + if (sigaddset(&sigset, dispatchsig[i].sig) < 0) + eprintf("sinit: sigaddset:"); + if (sigprocmask(SIG_BLOCK, &sigset, NULL) < 0) + eprintf("sinit: sigprocmask:"); sigfd = signalfd(-1, &sigset, 0); if (sigfd < 0) @@ -74,8 +77,8 @@ main(void) if (ret > 0) { if (FD_ISSET(sigfd, &rfds)) { n = read(sigfd, &siginfo, sizeof(siginfo)); - if (n <= 0) - continue; + if (n < 0) + eprintf("sinit: read:"); for (i = 0; i < LEN(dispatchsig); i++) if (dispatchsig[i].sig == siginfo.ssi_signo) dispatchsig[i].func(); -- cgit v1.2.3-70-g09d2