mirror of
https://github.com/troglobit/finit.git
synced 2026-10-17 10:49:34 +00:00
Only remove managed pidfiles in service cleanup
For SysV services with pid:!/path, the pidfile belongs to the service itself and Finit shouldn't delete it. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 file changed
+8
-5
+8
-5
@@ -1079,15 +1079,18 @@ static void service_notify_stop(svc_t *svc)
|
||||
static void service_cleanup(svc_t *svc)
|
||||
{
|
||||
char cond[MAX_COND_LEN];
|
||||
char *fn;
|
||||
|
||||
/* PID collected, cancel any pending SIGKILL */
|
||||
service_timeout_cancel(svc);
|
||||
|
||||
fn = pid_file(svc);
|
||||
if (fn && remove(fn) && errno != ENOENT)
|
||||
logit(LOG_CRIT, "Failed removing service %s pidfile %s",
|
||||
svc_ident(svc, NULL, 0), fn);
|
||||
/* Only clean up process' pidfile if managed by us */
|
||||
if (svc_has_pidfile(svc)) {
|
||||
char *fn = pid_file(svc);
|
||||
|
||||
if (remove(fn) && errno != ENOENT)
|
||||
logit(LOG_CRIT, "Failed removing service %s pidfile %s",
|
||||
svc_ident(svc, NULL, 0), fn);
|
||||
}
|
||||
|
||||
/*
|
||||
* Invalidate the pid/ condition for this service to ensure
|
||||
|
||||
Reference in new issue
Block a user