From d77f0127b4c6959415ac20fa9d03ab3048f4658e Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 22 Feb 2026 15:30:16 +0100 Subject: [PATCH] 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 --- src/api.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/api.c b/src/api.c index 85373350..a0af4542 100644 --- a/src/api.c +++ b/src/api.c @@ -126,17 +126,22 @@ static int reload(svc_t *svc, void *user_data) /* * Clear conditions before reload to ensure dependent services - * are properly updated. The conditions are reasserted when - * the service touches its PID file after processing SIGHUP. + * are properly updated. Only needed when the service does NOT + * 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 * inotify handler reasserts it (pid/none). For s6/systemd * services readiness relies on their respective notification * mechanism which may not re-trigger on SIGHUP. */ - cond_clear(mkcond(svc, cond, sizeof(cond))); - if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE) - service_ready(svc, 0); + if (svc_is_noreload(svc)) { + cond_clear(mkcond(svc, cond, sizeof(cond))); + if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE) + service_ready(svc, 0); + } svc_mark_dirty(svc); service_step(svc);