From da30767353eb1cc13826176bf19308a05c7bade4 Mon Sep 17 00:00:00 2001
From: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun, 29 Nov 2020 21:22:43 -0600
Subject: supervise-daemon: do not spawn a process if we are exiting

This fixes #375 and allows us to not add another level of indentation in
the supervisor loop.
---
 src/rc/supervise-daemon.c | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'src')

diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index ea9e5333..d43f1031 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -648,6 +648,8 @@ static void supervisor(char *exec, char **argv)
 			ts.tv_sec = respawn_delay;
 			ts.tv_nsec = 0;
 			nanosleep(&ts, NULL);
+			if (exiting)
+				continue;
 			child_pid = fork();
 			if (child_pid == -1) {
 				syslog(LOG_ERR, "%s: fork: %s", applet, strerror(errno));
-- 
cgit v1.2.3