Set TERM to linux if needed for su and login

This commit is contained in:
sin 2014-06-03 18:19:31 +01:00
parent 8216a97519
commit 916b7fed1e
2 changed files with 2 additions and 1 deletions

View File

@ -117,6 +117,7 @@ dologin(struct passwd *pw, int preserve)
setenv("SHELL", pw->pw_shell, !preserve); setenv("SHELL", pw->pw_shell, !preserve);
setenv("USER", pw->pw_name, !preserve); setenv("USER", pw->pw_name, !preserve);
setenv("LOGNAME", pw->pw_name, !preserve); setenv("LOGNAME", pw->pw_name, !preserve);
setenv("TERM", "linux", !preserve);
setenv("PATH", ENV_PATH, !preserve); setenv("PATH", ENV_PATH, !preserve);
if (chdir(pw->pw_dir) < 0) if (chdir(pw->pw_dir) < 0)
eprintf("chdir %s:", pw->pw_dir); eprintf("chdir %s:", pw->pw_dir);

2
su.c
View File

@ -171,7 +171,7 @@ dologin(struct passwd *pw)
setenv("SHELL", pw->pw_shell, 1); setenv("SHELL", pw->pw_shell, 1);
setenv("USER", pw->pw_name, 1); setenv("USER", pw->pw_name, 1);
setenv("LOGNAME", pw->pw_name, 1); setenv("LOGNAME", pw->pw_name, 1);
setenv("TERM", term ? term : "vt100", 1); setenv("TERM", term ? term : "linux", 1);
if (strcmp(pw->pw_name, "root") == 0) if (strcmp(pw->pw_name, "root") == 0)
setenv("PATH", ENV_SUPATH, 1); setenv("PATH", ENV_SUPATH, 1);
else else