Preserve SHELL variable for "sudo -s". Otherwise we can end up

with a situation where the SHELL variable and the actual shell being
run do not match.
This commit is contained in:
Todd C. Miller
2011-06-13 07:20:28 -04:00
parent b4a48510cd
commit 7a06f32cbb

View File

@@ -390,6 +390,10 @@ matches_env_keep(const char *var)
size_t len;
int iswild, keepit = FALSE;
/* Preserve SHELL variable for "sudo -s". */
if (ISSET(sudo_mode, MODE_SHELL) && strncmp(var, "SHELL=", 6) == 0)
return TRUE;
for (cur = def_env_keep; cur; cur = cur->next) {
len = strlen(cur->value);
/* Deal with '*' wildcard */