Fix preserving of variables in env_keep.
This commit is contained in:
6
env.c
6
env.c
@@ -310,11 +310,9 @@ rebuild_env(envp, sudo_mode, noexec)
|
||||
didvar = 0;
|
||||
memset(&env, 0, sizeof(env));
|
||||
if (def_env_reset) {
|
||||
int keepit = -1;
|
||||
|
||||
/* Pull in vars we want to keep from the old environment. */
|
||||
for (ep = envp; *ep; ep++) {
|
||||
keepit = FALSE;
|
||||
int keepit = -1;
|
||||
|
||||
/* Skip variables with values beginning with () (bash functions) */
|
||||
if ((cp = strchr(*ep, '=')) != NULL) {
|
||||
@@ -354,6 +352,8 @@ rebuild_env(envp, sudo_mode, noexec)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (keepit == -1)
|
||||
keepit = FALSE;
|
||||
|
||||
/* For SUDO_PS1 -> PS1 conversion. */
|
||||
if (strncmp(*ep, "SUDO_PS1=", 8) == 0)
|
||||
|
Reference in New Issue
Block a user