mirror of
https://github.com/troglobit/finit.git
synced 2026-11-01 13:10:32 +00:00
Fix #100: Adjust path to COND_RECONF /var/run symlink may be missing
On systems with the new /run hierarchy the compat symlink from /var/run may be missing, or not yet be set up by bootmisc.so. This patch adds a layer of safety to the condition layer, both set and get cond ops now perform an adjustmed of the condition path if needed. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
90249e50ef
commit
dc7039b8d8
3 files changed
+26
-5
No files matched your search
+6
-2
@@ -51,13 +51,17 @@ const char *cond_path(const char *name)
|
||||
return pid_runpath(tmp, file, sizeof(file));
|
||||
}
|
||||
|
||||
unsigned int cond_get_gen(const char *path)
|
||||
unsigned int cond_get_gen(const char *file)
|
||||
{
|
||||
char *ptr, path[256];
|
||||
unsigned int gen;
|
||||
FILE *fp;
|
||||
int ret;
|
||||
|
||||
fp = fopen(path, "r");
|
||||
/* /var/run --> /run symlink may not exist (yet) */
|
||||
ptr = pid_runpath(file, path, sizeof(path));
|
||||
|
||||
fp = fopen(ptr, "r");
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user