mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +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)
|
static void service_cleanup(svc_t *svc)
|
||||||
{
|
{
|
||||||
char cond[MAX_COND_LEN];
|
char cond[MAX_COND_LEN];
|
||||||
char *fn;
|
|
||||||
|
|
||||||
/* PID collected, cancel any pending SIGKILL */
|
/* PID collected, cancel any pending SIGKILL */
|
||||||
service_timeout_cancel(svc);
|
service_timeout_cancel(svc);
|
||||||
|
|
||||||
fn = pid_file(svc);
|
/* Only clean up process' pidfile if managed by us */
|
||||||
if (fn && remove(fn) && errno != ENOENT)
|
if (svc_has_pidfile(svc)) {
|
||||||
logit(LOG_CRIT, "Failed removing service %s pidfile %s",
|
char *fn = pid_file(svc);
|
||||||
svc_ident(svc, NULL, 0), fn);
|
|
||||||
|
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
|
* Invalidate the pid/ condition for this service to ensure
|
||||||
|
|||||||
Reference in new issue
Block a user