X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-seat.c;h=49808c928b0db389126e7365206ae18a0c6a6936;hb=a0ff42a4da79b0885853ca6b528e50b9d20e3c0e;hp=8eb5e3ee0a58d72d4f261fb3798a424c8144621c;hpb=da927ba997d68401563b927f92e6e40e021a8e5c;p=elogind.git diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 8eb5e3ee0..49808c928 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -19,21 +19,16 @@ along with systemd; If not, see . ***/ -#include #include #include #include -#include -#include #include -#include "sd-id128.h" #include "sd-messages.h" #include "logind-seat.h" #include "logind-acl.h" #include "util.h" #include "mkdir.h" -#include "path-util.h" Seat *seat_new(Manager *m, const char *id) { Seat *s; @@ -201,7 +196,7 @@ int seat_preallocate_vts(Seat *s) { q = vt_allocate(i); if (q < 0) { - log_error_errno(q, "Failed to preallocate VT %i: %m", i); + log_error_errno(q, "Failed to preallocate VT %u: %m", i); r = q; } } @@ -340,12 +335,24 @@ int seat_active_vt_changed(Seat *s, unsigned int vtnr) { log_debug("VT changed to %u", vtnr); + /* we might have earlier closing sessions on the same VT, so try to + * find a running one first */ LIST_FOREACH(sessions_by_seat, i, s->sessions) - if (i->vtnr == vtnr) { + if (i->vtnr == vtnr && !i->stopping) { new_active = i; break; } + if (!new_active) { + /* no running one? then we can't decide which one is the + * active one, let the first one win */ + LIST_FOREACH(sessions_by_seat, i, s->sessions) + if (i->vtnr == vtnr) { + new_active = i; + break; + } + } + r = seat_set_active(s, new_active); manager_spawn_autovt(s->manager, vtnr);