summaryrefslogtreecommitdiff
path: root/src/login/logind-session.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-11-28 17:25:25 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-28 17:41:38 +0100
commitc506027af881a9e4210845a7a8a6ec5910aa0f3b (patch)
tree841c0aa91d455bc7e81f601a7532dcded97e65bf /src/login/logind-session.c
parent92bd5ff3a062c3f9475b9d9d39b9335bfeb7705e (diff)
logind: require VTs on seat0 and forbid elsewhere
Sessions on seat0 must pass us a vtnr, otherwise, you shouldn't try attaching it to seat0. For seats without VTs, we do the exact opposite: we forbid VTs. There can be odd situations if the session-files contain invalid combinations. However, we try to keep sessions alive and restore state as good as possible.
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r--src/login/logind-session.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index cd87088456..a72b13ee03 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -334,21 +334,21 @@ int session_load(Session *s) {
s->remote = k;
}
+ if (vtnr)
+ safe_atou(vtnr, &s->vtnr);
+
if (seat && !s->seat) {
Seat *o;
o = hashmap_get(s->manager->seats, seat);
if (o)
- seat_attach_session(o, s);
+ r = seat_attach_session(o, s);
+ if (!o || r < 0)
+ log_error("Cannot attach session %s to seat %s", s->id, seat);
}
- if (vtnr && s->seat && seat_has_vts(s->seat)) {
- unsigned int v;
-
- k = safe_atou(vtnr, &v);
- if (k >= 0 && v >= 1)
- s->vtnr = v;
- }
+ if (!s->seat || !seat_has_vts(s->seat))
+ s->vtnr = 0;
if (leader) {
k = parse_pid(leader, &s->leader);