mirror of
https://github.com/troglobit/finit.git
synced 2026-09-30 13:02:37 +07:00
Fix #392: ensure 'ready' condition is cleared on pidfile removal
A service with notify:pid is 'ready' when the pidfile has been created,
the converse also holds true -- when a pidfile is removed the service is
no longer 'ready'.
The state transition for the service has probably already been done, in
svc_set_state(), clearing all <service/foo/*> conditions when the PID
was collected. The pidfile event may arrive later, so for completeness
we make sure the 'ready' condition is not recreated at least.
Problem introduced in 912a281 with the original supoport for service
readiness notification.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+3
-3
@@ -123,11 +123,11 @@ static void pidfile_update_conds(char *dir, char *name, uint32_t mask)
|
||||
if (svc->notify == SVC_NOTIFY_PID)
|
||||
cond_set(cond);
|
||||
if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE)
|
||||
service_ready(svc);
|
||||
service_ready(svc, 1);
|
||||
} else if (mask & IN_DELETE) {
|
||||
cond_clear(cond);
|
||||
if (svc->notify == SVC_NOTIFY_PID)
|
||||
service_ready(svc);
|
||||
service_ready(svc, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ static void pidfile_reconf(void *arg)
|
||||
continue;
|
||||
|
||||
if (svc->notify == SVC_NOTIFY_PID)
|
||||
service_ready(svc);
|
||||
service_ready(svc, 1);
|
||||
|
||||
mkcond(svc, cond, sizeof(cond));
|
||||
if (cond_get(cond) == COND_ON)
|
||||
|
||||
Reference in New Issue
Block a user