mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-28 17:57:25 +03:00
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.
This commit is contained in:
parent
8b89628a10
commit
6a93917df9
@ -2436,11 +2436,12 @@ static int exec_child(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (context->utmp_id)
|
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_INIT ? INIT_PROCESS :
|
||||||
context->utmp_mode == EXEC_UTMP_LOGIN ? LOGIN_PROCESS :
|
context->utmp_mode == EXEC_UTMP_LOGIN ? LOGIN_PROCESS :
|
||||||
USER_PROCESS,
|
USER_PROCESS,
|
||||||
username ? "root" : context->user);
|
username);
|
||||||
|
|
||||||
if (context->user) {
|
if (context->user) {
|
||||||
r = chown_terminal(STDIN_FILENO, uid);
|
r = chown_terminal(STDIN_FILENO, uid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user