Introduction
Introduction Statistics Contact Development Disclaimer Help
Some more error checking just to be sure - sinit - suckless init
git clone git://git.suckless.org/sinit
Log
Files
Refs
README
LICENSE
---
commit 9ad5329913cf99e5498ddff228d5906f9570e28b
parent 76b2240e1587129d4baefaffb738332440e20290
Author: sin <[email protected]>
Date: Fri, 7 Feb 2014 16:46:16 +0000
Some more error checking just to be sure
Diffstat:
M sinit.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_…
dispatchsig[i].func();
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.