ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit 01fa8eec5842f90e8afa60e3429daa87ee104e22
parent d522589a1178b5e82ec0195e01a5c368ccd6687a
Author: sin <sin@2f30.org>
Date:   Tue,  3 Jun 2014 18:56:46 +0100

Fix login(1) -p semantincs once and for all

Diffstat:
Mlogin.1 | 2+-
Mlogin.c | 11+++++------
2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/login.1 b/login.1 @@ -5,7 +5,7 @@ \fBlogin\fR [\fB-p\fR] \fIusername\fR .SH DESCRIPTION \fBlogin\fR logs the \fIusername\fR into the system. It sets \fBHOME\fR, -\fBSHELL\fR, \fBUSER\fR, \fBLOGNAME\fR, \fBTERM\fR and the \fBPATH\fR environment +\fBSHELL\fR, \fBUSER\fR, \fBLOGNAME\fR and the \fBPATH\fR environment variables and invokes the login shell as specified in \fI/etc/passwd\fR. .SH OPTIONS .TP diff --git a/login.c b/login.c @@ -113,12 +113,11 @@ dologin(struct passwd *pw, int preserve) { if (preserve == 0) clearenv(); - setenv("HOME", pw->pw_dir, !preserve); - setenv("SHELL", pw->pw_shell, !preserve); - setenv("USER", pw->pw_name, !preserve); - setenv("LOGNAME", pw->pw_name, !preserve); - setenv("TERM", "linux", !preserve); - setenv("PATH", ENV_PATH, !preserve); + setenv("HOME", pw->pw_dir, 1); + setenv("SHELL", pw->pw_shell, 1); + setenv("USER", pw->pw_name, 1); + setenv("LOGNAME", pw->pw_name, 1); + setenv("PATH", ENV_PATH, 1); if (chdir(pw->pw_dir) < 0) eprintf("chdir %s:", pw->pw_dir); execlp(pw->pw_shell, pw->pw_shell, "-l", NULL);