]> git.ipfire.org Git - thirdparty/systemd.git/commit
logind: become the controlling terminal process before restoring VT
authorFranck Bui <fbui@suse.com>
Mon, 27 Aug 2018 20:13:21 +0000 (22:13 +0200)
committerFranck Bui <fbui@suse.com>
Wed, 21 Nov 2018 13:25:10 +0000 (14:25 +0100)
commitad96887a1205bad9656d280c5681f482e6d04838
tree14b08ee3da844bdaa3cc87dcf767e324c714ccb7
parent6179ede1c55c0b7b31b8f71e17d68ec2318ef2d5
logind: become the controlling terminal process before restoring VT

Basically when a session ends, logind notices and restores VT_AUTO so the
kernel takes back VT-switching over.

logind achieves that by watching the process that took control of the session
(via the "TakeControl" D-Bus method), aka "the watched process", which can
be different from the one that initially opened the VT aka "the terminal
controlling process".

In this case the terminal controlling process can exit after the watched one
did and while logind is restoring the VT.

Even if logind took care to re-open the VT in case the VT was already in HUP
state, it wasn't enough because the terminal controlling process could have
exited right after, leaving the VT in HUP state and in VT_PROCESS mode making
further VT-switching impossible.

This patch fixes this situation by forcing logind to become the terminal
controlling process.

Fixes: #9754.
src/login/logind-session.c