diff --git a/src/conf.c b/src/conf.c index ea4c6c11..7621e8e2 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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); }