aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-29 21:39:41 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-29 21:39:41 +0100
commitfab1a7f1117b70cdffebba48801612be3f849cb7 (patch)
treeb8253b1f6aec32102f45e702f9345b5f211bb29e /src
parentimplement satd-timer (diff)
downloadsat-fab1a7f1117b70cdffebba48801612be3f849cb7.tar.gz
sat-fab1a7f1117b70cdffebba48801612be3f849cb7.tar.bz2
sat-fab1a7f1117b70cdffebba48801612be3f849cb7.tar.xz
typo + do not spawn satd-timer if it is already running
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src')
-rw-r--r--src/satd-diminished.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/satd-diminished.c b/src/satd-diminished.c
index a0fbd8b..43017fa 100644
--- a/src/satd-diminished.c
+++ b/src/satd-diminished.c
@@ -44,7 +44,7 @@
/**
* The value on `timer_pid` when there is not "timer" image running.
*/
-#define NO_TIMER_SPAWED -2 /* Must be negative, but not -1. */
+#define NO_TIMER_SPAWNED -2 /* Must be negative, but not -1. */
@@ -54,11 +54,11 @@
static volatile sig_atomic_t received_signo = SIGCHLD; /* Forces the "timer" image to run. */
/**
- * The PID the "timer" fork, `NO_TIMER_SPAWED` if not running.
+ * The PID the "timer" fork, `NO_TIMER_SPAWNED` if not running.
*
* It does not matter that this is lost on a successful SIGHUP.
*/
-static volatile pid_t timer_pid = NO_TIMER_SPAWED;
+static volatile pid_t timer_pid = NO_TIMER_SPAWNED;
@@ -72,7 +72,7 @@ sighandler(int signo)
{
int saved_errno = errno;
if ((signo == SIGCHLD) && (waitpid(-1, NULL, WNOHANG) == timer_pid))
- timer_pid = NO_TIMER_SPAWED;
+ timer_pid = NO_TIMER_SPAWNED;
else
received_signo = (sig_atomic_t)signo;
errno = saved_errno;
@@ -166,7 +166,7 @@ test_timer(int fd, const fd_set *fdset)
};
if (!FD_ISSET(BOOT_FILENO, fdset)) return 0;
if (read(BOOT_FILENO, &_overrun, (size_t)8) < 8) return -1;
- if (timer_pid == NO_TIMER_SPAWED) return 0;
+ if (timer_pid == NO_TIMER_SPAWNED) return 0;
return timerfd_settime(fd, TFD_TIMER_ABSTIME, &spec, NULL);
}
@@ -194,7 +194,7 @@ main(int argc, char *argv[], char *envp[])
/* The magnificent loop. */
again:
- if (accepted && (timer_pid == NO_TIMER_SPAWED)) {
+ if (accepted && (timer_pid == NO_TIMER_SPAWNED)) {
t (r = is_timer_set(BOOT_FILENO), r < 0); if (r) goto not_done;
t (r = is_timer_set(REAL_FILENO), r < 0); if (r) goto not_done;
goto done;
@@ -203,7 +203,7 @@ not_done:
if (received_signo == SIGHUP) {
execve(DAEMON_IMAGE("diminished"), argv, envp);
perror(argv[0]);
- } else if (received_signo == SIGCHLD) {
+ } else if ((received_signo == SIGCHLD) && (timer_pid == NO_TIMER_SPAWNED)) {
t (spawn(-1, -1, argv, envp));
}
received_signo = 0;