diff options
author | Franck Bui <fbui@suse.com> | 2017-04-26 14:20:41 +0200 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2017-06-08 16:21:36 +0200 |
commit | dc6284e9efb0a6801dd7a951d39ebb7d9a279676 (patch) | |
tree | 9a0889495859a3f3433083872a54fddcd7495162 /src/login/logind-session.c | |
parent | 4c47affcf1e501431f3cb567c516ec252dfc4bbc (diff) | |
download | systemd-dc6284e9efb0a6801dd7a951d39ebb7d9a279676.tar.gz |
logind: when setting a new controller, don't prepare the VT if logind is restarted
When assigning a new session controller to a session, the VT is prepared so the
controller can expect the VT to be in a good default state.
However when logind is restarted and a session controller already took control
of a session, there's no need to prepare th VT otherwise logind may screw up
the VT state set by the controller.
This patch prevents the preparation of the VT in this case.
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r-- | src/login/logind-session.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 4a168906d6..ae05877a68 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -449,7 +449,7 @@ int session_load(Session *s) { if (controller) { if (bus_name_has_owner(s->manager->bus, controller, NULL) > 0) - session_set_controller(s, controller, false); + session_set_controller(s, controller, false, false); else session_restore_vt(s); } @@ -1170,7 +1170,7 @@ static int on_bus_track(sd_bus_track *track, void *userdata) { return 0; } -int session_set_controller(Session *s, const char *sender, bool force) { +int session_set_controller(Session *s, const char *sender, bool force, bool prepare) { _cleanup_free_ char *name = NULL; int r; @@ -1202,11 +1202,14 @@ int session_set_controller(Session *s, const char *sender, bool force) { * Note that we reset the VT on ReleaseControl() and if the controller * exits. * If logind crashes/restarts, we restore the controller during restart - * or reset the VT in case it crashed/exited, too. */ - r = session_prepare_vt(s); - if (r < 0) { - s->track = sd_bus_track_unref(s->track); - return r; + * (without preparing the VT since the controller has probably overridden + * VT state by now) or reset the VT in case it crashed/exited, too. */ + if (prepare) { + r = session_prepare_vt(s); + if (r < 0) { + s->track = sd_bus_track_unref(s->track); + return r; + } } session_release_controller(s, true); |