Fix preserving of variables in env_keep.

This commit is contained in:
Todd C. Miller
2007-06-19 16:53:09 +00:00
parent f670ef29bc
commit 363a2f2593

6
env.c
View File

@@ -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)