aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--src/satd-diminished.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 918f334..b7fc1a6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ sat NEWS -*- outline -*-
the actions of the commands are handled directly
in the command rather than delegated. The daemon
is let known via a SIGCHLD signal (not code added
- to satd, only removed.)
+ to satd, well barely any, only removed.)
* Noteworthy changes in release 1.0 (2016-(01)Jan-01 UTC) [stable]
diff --git a/src/satd-diminished.c b/src/satd-diminished.c
index 5404327..811c545 100644
--- a/src/satd-diminished.c
+++ b/src/satd-diminished.c
@@ -74,18 +74,19 @@ static const struct itimerspec nilspec = {
static void
sighandler(int signo)
{
- int saved_errno = errno;
+ int no_reap = 1, saved_errno = errno;
pid_t pid;
if (signo == SIGCHLD) {
for (; (pid = waitpid(-1, NULL, WNOHANG)) > 0; child_count--) {
+ no_reap = 0;
if (pid == timer_pid)
timer_pid = NO_TIMER_SPAWNED;
else
received_signo = (sig_atomic_t)signo;
}
- } else {
- received_signo = (sig_atomic_t)signo;
}
+ if (no_reap) /* Phony SIGCHLD or not SIGCHLD at all. */
+ received_signo = (sig_atomic_t)signo;
errno = saved_errno;
}
@@ -187,8 +188,8 @@ again:
perror(argv[0]);
}
/* Need to set new timer values? */
- if (expired || ((received_signo == SIGCHLD) && !child_count))
- t (expired = 0, spawn(argv, envp));
+ if ((received_signo == SIGCHLD) && !child_count)
+ t (spawn(argv, envp));
received_signo = 0;
#if 1 || !defined(DEBUG)
/* Can we quit yet? */