* [PATCH] login: add USER to initial environment
@ 2012-03-11 4:54 Dave Reisner
2012-03-13 11:28 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Dave Reisner @ 2012-03-11 4:54 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
Add this value from the passwd struct to the environment, as it is
expected by shells, and generally useful to users.
This also clarifies a poorly worded sentence in the vicinity of the
manpage change.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
login-utils/login.1 | 5 +++--
login-utils/login.c | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/login-utils/login.1 b/login-utils/login.1
index 26cd951..cb80241 100644
--- a/login-utils/login.1
+++ b/login-utils/login.1
@@ -40,10 +40,11 @@ for more information.
The user and group ID will be set according to their values in the
.I /etc/passwd
file. There is one exception if the user ID is zero: in this case,
-only the primary group ID of the account is set. This should prevent
-that the system adminitrator cannot login in case of network problems.
+only the primary group ID of the account is set. This should allow
+the system adminitrator to login even in case of network problems.
The value for
.BR $HOME ,
+.BR $USER ,
.BR $SHELL ,
.BR $PATH ,
.BR $LOGNAME ,
diff --git a/login-utils/login.c b/login-utils/login.c
index 4f448f8..6c3b6f7 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -1142,6 +1142,7 @@ static void init_environ(struct login_context *cxt)
}
setenv("HOME", pwd->pw_dir, 0); /* legal to override */
+ setenv("USER", pwd->pw_name, 1);
setenv("SHELL", pwd->pw_shell, 1);
setenv("TERM", termenv, 1);
--
1.7.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-13 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-11 4:54 [PATCH] login: add USER to initial environment Dave Reisner
2012-03-13 11:28 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox