[hackers] [st] Check for presence of SHELL environment variable || Eric Pruitt
commit bafbba56cd5735c680676db2adf6f614ba61356f
Author: Eric Pruitt <eric.pruitt_AT_gmail.com>
Date: Tue Oct 28 17:51:42 2014 -0700
Check for presence of SHELL environment variable
- POSIX states the SHELL environment variable "... shall represent a
pathname of the user's preferred command language interpreter." As
such, st should check for its presence when deciding what shell to
use; just as HOME can be defined to override one's passwd-defined home
directory, a user should also be able to override their passwd-defined
shell using the SHELL environment variable.
diff --git a/st.c b/st.c
index ad52280..068fbb3 100644
--- a/st.c
+++ b/st.c
_AT_@ -1158,7 +1158,10 @@ execsh(void) {
die("who are you?\n");
}
- sh = (pw->pw_shell[0]) ? pw->pw_shell : shell;
+ if (!(sh = getenv("SHELL"))) {
+ sh = (pw->pw_shell[0]) ? pw->pw_shell : shell;
+ }
+
if(opt_cmd)
prog = opt_cmd[0];
else if(utmp)
Received on Tue Nov 11 2014 - 19:21:10 CET
This archive was generated by hypermail 2.3.0
: Tue Nov 11 2014 - 19:24:12 CET