sinit

suckless init
git clone git://git.2f30.org/sinit
Log | Files | Refs | README | LICENSE

commit 9ad5329913cf99e5498ddff228d5906f9570e28b
parent 76b2240e1587129d4baefaffb738332440e20290
Author: sin <sin@2f30.org>
Date:   Fri,  7 Feb 2014 16:46:16 +0000

Some more error checking just to be sure

Diffstat:
Msinit.c | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git 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();