summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-03 11:32:42 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-03 11:49:43 -0500
commit6a93917df9c8c852387d71004ccb43b33da962cd (patch)
treed9292df05042b9c4c5e1d1ac83b1a7c46a3202d7
parent8b89628a10af3863bfc97872912e9da4076a5929 (diff)
core/execute: pass the username to utmp/wtmp database
Before previous commit, username would be NULL for root, and set only for other users. So the argument passed to utmp_put_init_process() would be "root" for other users and NULL for root. Seems strange. Instead, always pass the username if available.
-rw-r--r--src/core/execute.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 67b54a3bec..aa0ddb564e 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2436,11 +2436,12 @@ static int exec_child(
}
if (context->utmp_id)
- utmp_put_init_process(context->utmp_id, getpid(), getsid(0), context->tty_path,
+ utmp_put_init_process(context->utmp_id, getpid(), getsid(0),
+ context->tty_path,
context->utmp_mode == EXEC_UTMP_INIT ? INIT_PROCESS :
context->utmp_mode == EXEC_UTMP_LOGIN ? LOGIN_PROCESS :
USER_PROCESS,
- username ? "root" : context->user);
+ username);
if (context->user) {
r = chown_terminal(STDIN_FILENO, uid);