From: Dave Reisner <d@falconindy.com>
To: util-linux@vger.kernel.org
Cc: Dave Reisner <dreisner@archlinux.org>
Subject: [PATCH] login: add USER to initial environment
Date: Sat, 10 Mar 2012 23:54:14 -0500 [thread overview]
Message-ID: <1331441654-27958-1-git-send-email-dreisner@archlinux.org> (raw)
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
next reply other threads:[~2012-03-11 4:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-11 4:54 Dave Reisner [this message]
2012-03-13 11:28 ` [PATCH] login: add USER to initial environment Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331441654-27958-1-git-send-email-dreisner@archlinux.org \
--to=d@falconindy.com \
--cc=dreisner@archlinux.org \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox