mirror of
https://github.com/troglobit/finit.git
synced 2026-11-15 19:13:11 +00:00
Don't disrupt dependents on reload of SIGHUP-capable service
This fixes a real bug where `initctl reload syslogd` unconditionally clears syslogd's pid condition, causing all dependent services (dbus, dnsmasq, etc.) to be stopped even though syslogd handles SIGHUP gracefully and its PID/pidfile persist. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 file changed
+10
-5
@@ -126,17 +126,22 @@ static int reload(svc_t *svc, void *user_data)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear conditions before reload to ensure dependent services
|
* Clear conditions before reload to ensure dependent services
|
||||||
* are properly updated. The conditions are reasserted when
|
* are properly updated. Only needed when the service does NOT
|
||||||
* the service touches its PID file after processing SIGHUP.
|
* support SIGHUP (noreload), because then it will be stopped
|
||||||
|
* and restarted, so conditions genuinely go away. When the
|
||||||
|
* service handles SIGHUP, its PID and pidfile persist, so the
|
||||||
|
* condition stays valid and dependents should not be disrupted.
|
||||||
*
|
*
|
||||||
* Note: only clear 'ready' for services where the pidfile
|
* Note: only clear 'ready' for services where the pidfile
|
||||||
* inotify handler reasserts it (pid/none). For s6/systemd
|
* inotify handler reasserts it (pid/none). For s6/systemd
|
||||||
* services readiness relies on their respective notification
|
* services readiness relies on their respective notification
|
||||||
* mechanism which may not re-trigger on SIGHUP.
|
* mechanism which may not re-trigger on SIGHUP.
|
||||||
*/
|
*/
|
||||||
cond_clear(mkcond(svc, cond, sizeof(cond)));
|
if (svc_is_noreload(svc)) {
|
||||||
if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE)
|
cond_clear(mkcond(svc, cond, sizeof(cond)));
|
||||||
service_ready(svc, 0);
|
if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE)
|
||||||
|
service_ready(svc, 0);
|
||||||
|
}
|
||||||
|
|
||||||
svc_mark_dirty(svc);
|
svc_mark_dirty(svc);
|
||||||
service_step(svc);
|
service_step(svc);
|
||||||
|
|||||||
Reference in new issue
Block a user