utmp: remove /dev from line
utmp(5) says `ut_line` is the device name minus the leading "/dev/". Therefore, remove it. Without that, when using UtmpMode=user, we get `/dev/tty` in the output of `last`/`w`.
This commit is contained in:
committed by
Lennart Poettering
parent
07721d1380
commit
33331d116d
+6
-2
@@ -4136,13 +4136,17 @@ static int exec_child(
|
||||
}
|
||||
}
|
||||
|
||||
if (context->utmp_id)
|
||||
if (context->utmp_id) {
|
||||
const char *line = context->tty_path ?
|
||||
(path_startswith(context->tty_path, "/dev/") ?: context->tty_path) :
|
||||
NULL;
|
||||
utmp_put_init_process(context->utmp_id, getpid_cached(), getsid(0),
|
||||
context->tty_path,
|
||||
line,
|
||||
context->utmp_mode == EXEC_UTMP_INIT ? INIT_PROCESS :
|
||||
context->utmp_mode == EXEC_UTMP_LOGIN ? LOGIN_PROCESS :
|
||||
USER_PROCESS,
|
||||
username);
|
||||
}
|
||||
|
||||
if (uid_is_valid(uid)) {
|
||||
r = chown_terminal(STDIN_FILENO, uid);
|
||||
|
||||
Reference in New Issue
Block a user