X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind-session.c;h=a72b13ee0363c3826836706c36c4f4dd64439c00;hp=cd87088456782b07d2b72756ca83a882d03277f4;hb=c506027af881a9e4210845a7a8a6ec5910aa0f3b;hpb=92bd5ff3a062c3f9475b9d9d39b9335bfeb7705e diff --git a/src/login/logind-session.c b/src/login/logind-session.c index cd8708845..a72b13ee0 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);