diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2016-01-02 00:35:12 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2016-01-02 00:35:12 +0100 |
commit | 7d921ad80050356a8795d9fcaa1d5aa0c51159ee (patch) | |
tree | 129e5fe3c88be7da6b7f835a895a40c5cee7aabc /src | |
parent | m (diff) | |
download | sat-7d921ad80050356a8795d9fcaa1d5aa0c51159ee.tar.gz sat-7d921ad80050356a8795d9fcaa1d5aa0c51159ee.tar.bz2 sat-7d921ad80050356a8795d9fcaa1d5aa0c51159ee.tar.xz |
fix bug
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/satd-diminished.c | 11 |
1 files changed, 6 insertions, 5 deletions
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? */ |