SHELL must contain the value of the SHELL of the user. execsh() was reading this variable from the environment of the user, and in case of being NULL it was setting SHELL with the value of /etc/passwd, but in this case it was executing the default shell specified in config.h. --- st.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/st.c b/st.c index e0aae9d..d2929d0 100644 --- a/st.c +++ b/st.c @@ -1142,7 +1142,7 @@ die(const char *errstr, ...) { void execsh(void) { char **args; - char *envshell = getenv("SHELL"); + char *envshell; const struct passwd *pass = getpwuid(getuid()); char buf[sizeof(long) * 8 + 1]; @@ -1156,7 +1156,6 @@ execsh(void) { setenv("SHELL", pass->pw_shell, 0); setenv("HOME", pass->pw_dir, 0); } - snprintf(buf, sizeof(buf), "%lu", xw.win); setenv("WINDOWID", buf, 1); @@ -1167,7 +1166,8 @@ execsh(void) { signal(SIGTERM, SIG_DFL); signal(SIGALRM, SIG_DFL); - DEFAULT(envshell, shell); + if ((envshell = getenv("SHELL")) == NULL) + setenv("SHELL", envshell = shell, 1); setenv("TERM", termname, 1); args = opt_cmd ? opt_cmd : (char *[]){envshell, "-i", NULL}; execvp(args[0], args); -- 2.0.1