mirror of
https://github.com/troglobit/finit.git
synced 2026-10-03 14:33:12 +07:00
cond.c: Normalize COND_PATH, some systems have /run not /var/run
On most modern Linux systems /run is a tmpfs that replaces /var/run. The latter is set up as a symlink to /run by the bootmisc.so plugin. However, Finit conditions rely on the /var/run/finit/cond prefix, which does not exist until bootmisc.so has run, which is *after* `mount -a` has run. Therefore, to have working conditions before we run `mount -a` we must normalize the path constructed by cond_path() to use either the /run or /var/run (default) prefix. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+4
-2
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "finit.h"
|
||||
#include "cond.h"
|
||||
#include "pid.h"
|
||||
#include "service.h"
|
||||
|
||||
|
||||
@@ -42,11 +43,12 @@ const char *condstr(enum cond_state s)
|
||||
|
||||
const char *cond_path(const char *name)
|
||||
{
|
||||
char tmp[MAX_ARG_LEN];
|
||||
static char file[MAX_ARG_LEN];
|
||||
|
||||
snprintf(file, sizeof(file), COND_PATH "/%s", name);
|
||||
snprintf(tmp, sizeof(tmp), COND_PATH "/%s", name);
|
||||
|
||||
return file;
|
||||
return pid_runpath(tmp, file, sizeof(file));
|
||||
}
|
||||
|
||||
unsigned int cond_get_gen(const char *path)
|
||||
|
||||
Reference in New Issue
Block a user