From 184c079c08387d1b0f74de25b63c56304d2156d0 Mon Sep 17 00:00:00 2001 From: bazub Date: Tue, 3 Mar 2026 20:31:33 +0000 Subject: [PATCH] Remove redundant global path var and fix memory corruption --- src/conf.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/conf.c b/src/conf.c index d0abb61d..6e8ec834 100644 --- a/src/conf.c +++ b/src/conf.c @@ -121,9 +121,6 @@ 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); @@ -377,8 +374,6 @@ void conf_parse_cmdline(int argc, char *argv[]) fstab = strdup(ptr); 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]); @@ -404,13 +399,9 @@ void conf_reset_env(void) free(node); } - if (path) - setenv("PATH", path, 1); - else + if (!getenv("PATH")) setenv("PATH", _PATH_STDPATH, 1); - if (shell) - setenv("SHELL", shell, 1); - else + if (!getenv("SHELL")) setenv("SHELL", _PATH_BSHELL, 1); setenv("LOGNAME", "root", 1); setenv("USER", "root", 1);