mirror of
https://github.com/troglobit/finit.git
synced 2026-10-15 10:29:35 +00:00
Allow Finit to inherit PATH and SHELL from env.
When started as a monitor in a container, or for the test suite run from distcheck, we must allow Finit to find its own tools like initctl. This should also be a more generic solution that cover more cases. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
47d8a83668
commit
2526431d8e
1 file changed
+13
-2
+13
-2
@@ -78,6 +78,9 @@ static uev_t etcw;
|
||||
|
||||
static TAILQ_HEAD(, conf_change) conf_change_list = TAILQ_HEAD_INITIALIZER(conf_change_list);
|
||||
|
||||
static char *path;
|
||||
static char *shell;
|
||||
|
||||
static int parse_conf(char *file, int is_rcsd);
|
||||
static void drop_changes(void);
|
||||
|
||||
@@ -326,6 +329,8 @@ void conf_parse_cmdline(int argc, char *argv[])
|
||||
fstab = strdup(FINIT_FSTAB);
|
||||
finit_conf = strdup(FINIT_CONF);
|
||||
finit_rcsd = strdup(FINIT_RCSD);
|
||||
path = getenv("PATH");
|
||||
shell = getenv("SHELL");
|
||||
|
||||
for (int i = 1; i < argc; i++)
|
||||
parse_arg(argv[i]);
|
||||
@@ -351,8 +356,14 @@ void conf_reset_env(void)
|
||||
free(node);
|
||||
}
|
||||
|
||||
setenv("PATH", _PATH_STDPATH, 1);
|
||||
setenv("SHELL", _PATH_BSHELL, 1);
|
||||
if (path)
|
||||
setenv("PATH", path, 1);
|
||||
else
|
||||
setenv("PATH", _PATH_STDPATH, 1);
|
||||
if (shell)
|
||||
setenv("SHELL", shell, 1);
|
||||
else
|
||||
setenv("SHELL", _PATH_BSHELL, 1);
|
||||
setenv("LOGNAME", "root", 1);
|
||||
setenv("USER", "root", 1);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user