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 <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-02-26 16:55:15 +01:00
1 parent 71ac8bb802
commit 12c470667f
2 files changed
+6 -5

No files matched your search

-2
View File
@@ -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
+6 -3
View File
@@ -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);
}
}