From 12c470667f31be04840885e3b6a72c9376dce283 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 26 Feb 2015 16:55:12 +0100 Subject: [PATCH] Only restart daemons when getting SIGCONT after SIGSTOP Fix `restart_any_lost_procs()`, called when finit recovers from being stopped for a while. This function should not restart task/run/inetd services when called -- must check for type `SVC_CMD_SERVICE` when iterating over all registered `svc_t`, just like a regular lost pid. Signed-off-by: Joachim Nilsson --- TODO.md | 2 -- svc.c | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 5c8a4238..76b71f18 100644 --- a/TODO.md +++ b/TODO.md @@ -31,8 +31,6 @@ General * Move `finit.conf` "check" command to plugin which checks `/etc/fstab` instead. This is the de-facto practice. But keep the check command for really low-end systems w/o `/etc/fstab`. -* Fix `restart_any_lost_procs()`, currently it restarts task/run when - called -- must check `SVC_CMD_SERVICE`, like `svc_monitor()` does. Init diff --git a/svc.c b/svc.c index e615b464..0873ef09 100644 --- a/svc.c +++ b/svc.c @@ -481,12 +481,15 @@ static void restart_any_lost_procs(void) svc_t *svc; for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) { - if (svc->type == SVC_CMD_INETD) - continue; - if (svc->pid > 0 && pid_alive(svc->pid)) continue; + /* Only restart lost daemons, not task/run/inetd services */ + if (SVC_CMD_SERVICE != svc->type) { + svc->pid = 0; + continue; + } + svc_start(svc); } }