From: Todd C. Miller Date: Mon, 13 Jun 2011 11:21:18 +0000 (-0400) Subject: Preserve SHELL variable for "sudo -s". Otherwise we can end up X-Git-Tag: SUDO_1_7_7~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd738de0057c4b41ff1276563307d86f3b4ce2fb;p=sudo 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. --HG-- branch : 1.7 --- diff --git a/env.c b/env.c index 654565edc..5eb1a2acf 100644 --- a/env.c +++ b/env.c @@ -568,6 +568,10 @@ matches_env_keep(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 */