Introduction
Introduction Statistics Contact Development Disclaimer Help
Don't nest too much - sinit - suckless init
git clone git://git.suckless.org/sinit
Log
Files
Refs
README
LICENSE
---
commit a4ddecaa6a99210f9bc6910c078a3a1cf1667c30
parent 314b062efc5961bc3743df484a5cea9e7e62181f
Author: sin <[email protected]>
Date: Fri, 7 Feb 2014 21:08:57 +0000
Don't nest too much
Diffstat:
M sinit.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/sinit.c b/sinit.c
@@ -56,9 +56,11 @@ main(void)
if (sigemptyset(&sigset) < 0)
eprintf("sinit: sigemptyset:");
+
for (i = 0; i < LEN(dispatchsig); i++)
if (sigaddset(&sigset, dispatchsig[i].sig) < 0)
eprintf("sinit: sigaddset:");
+
if (sigprocmask(SIG_BLOCK, &sigset, NULL) < 0)
eprintf("sinit: sigprocmask:");
@@ -74,17 +76,17 @@ main(void)
ret = select(sigfd + 1, &rfds, NULL, NULL, NULL);
if (ret < 0)
eprintf("sinit: select:");
- if (ret > 0) {
- if (FD_ISSET(sigfd, &rfds)) {
- n = read(sigfd, &siginfo, sizeof(siginfo));
- if (n < 0)
- eprintf("sinit: read:");
- if (n != sizeof(siginfo))
- continue;
- for (i = 0; i < LEN(dispatchsig); i++)
- if (dispatchsig[i].sig == siginfo.ssi_…
- dispatchsig[i].func();
- }
+ if (ret == 0)
+ continue;
+ if (FD_ISSET(sigfd, &rfds)) {
+ n = read(sigfd, &siginfo, sizeof(siginfo));
+ if (n < 0)
+ eprintf("sinit: read:");
+ if (n != sizeof(siginfo))
+ continue;
+ for (i = 0; i < LEN(dispatchsig); i++)
+ if (dispatchsig[i].sig == siginfo.ssi_signo)
+ 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.