mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
Don't guess pid file name, either there's one declared or not
The previous patch just added dynamic tracking of non-declared pid files, so we no longer need to make stuff up. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
280608f30e
commit
572291a1d9
2 files changed
+3
-6
No files matched your search
@@ -95,18 +95,15 @@ char *pid_get_name(pid_t pid, char *name, size_t len)
|
|||||||
|
|
||||||
char *pid_file(svc_t *svc)
|
char *pid_file(svc_t *svc)
|
||||||
{
|
{
|
||||||
static char path[256];
|
|
||||||
char fn[MAX_ARG_LEN];
|
|
||||||
|
|
||||||
if (svc->pidfile[0]) {
|
if (svc->pidfile[0]) {
|
||||||
if (svc->pidfile[0] == '!')
|
if (svc->pidfile[0] == '!')
|
||||||
return &svc->pidfile[1];
|
return &svc->pidfile[1];
|
||||||
return svc->pidfile;
|
return svc->pidfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(fn, sizeof(fn), "%s%s.pid", _PATH_VARRUN, basename(svc->cmd));
|
errno = ENOENT;
|
||||||
|
|
||||||
return pid_runpath(fn, path, sizeof(path));
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t pid_file_read(const char *fn)
|
pid_t pid_file_read(const char *fn)
|
||||||
|
|||||||
+1
-1
@@ -616,7 +616,7 @@ static void service_cleanup(svc_t *svc)
|
|||||||
char *fn;
|
char *fn;
|
||||||
|
|
||||||
fn = pid_file(svc);
|
fn = pid_file(svc);
|
||||||
if (remove(fn) && errno != ENOENT)
|
if (fn && remove(fn) && errno != ENOENT)
|
||||||
logit(LOG_CRIT, "Failed removing service %s pidfile %s",
|
logit(LOG_CRIT, "Failed removing service %s pidfile %s",
|
||||||
basename(svc->cmd), fn);
|
basename(svc->cmd), fn);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user