]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: add USER to initial environment
authorDave Reisner <d@falconindy.com>
Sun, 11 Mar 2012 04:54:14 +0000 (23:54 -0500)
committerKarel Zak <kzak@redhat.com>
Tue, 13 Mar 2012 11:24:25 +0000 (12:24 +0100)
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
login-utils/login.c

index 26cd951acf701210cd5d837b8cc3047e9478cacb..cb8024100dc55f079c7bf1396bbcd0f04760e004 100644 (file)
@@ -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 ,
index 4f448f860794cf565e96fb01ae26e51f7ecdcb46..6c3b6f70910b68125b808ad08d7949f090d4b3dd 100644 (file)
@@ -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);