cond_init(): Create correct condition path, /var/run might not exist

The cond_init() function is called before the bootmisc.so plugin has
run.  It is responsble for setting up the /var/run symlink to /run on
systems with the new layout.  Therefore we must wrap COND_PATH with
pid_runpath() to create the correct runtime path.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2018-01-22 15:17:07 +01:00
1 parent 0da1deb487
commit 5f818f917e
1 file changed
+4 -1
+4 -1
View File
@@ -28,6 +28,7 @@
#include "finit.h"
#include "cond.h"
#include "pid.h"
#include "service.h"
static int cond_set_gen(const char *path, unsigned int gen)
@@ -224,7 +225,9 @@ void cond_reassert(const char *type)
void cond_init(void)
{
if (makepath(COND_PATH) && errno != EEXIST) {
char path[MAX_ARG_LEN];
if (makepath(pid_runpath(COND_PATH, path, sizeof(path))) && errno != EEXIST) {
_pe("Failed creating condition base directory '%s'", COND_PATH);
return;
}