X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Flogin%2Flogind-session.c;h=d67eb02f7d8d825a7d8293e20c27636b0fa0916d;hb=6b1c5e6d152a584896d71a3d9ad4d3f417050045;hp=9123d50fac012d0e9a24666316ae5c145ebc0608;hpb=648294227e8247f729d8cca927d3445ab1836f30;p=elogind.git diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 9123d50fa..d67eb02f7 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -35,7 +35,7 @@ #include "escape.h" #include "fd-util.h" #include "fileio.h" -#include "formats-util.h" +#include "format-util.h" #include "io-util.h" #include "logind-session.h" #include "mkdir.h" @@ -455,7 +455,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); } @@ -592,7 +592,7 @@ int session_start(Session *s) { return r; log_struct(s->class == SESSION_BACKGROUND ? LOG_DEBUG : LOG_INFO, - LOG_MESSAGE_ID(SD_MESSAGE_SESSION_START), + "MESSAGE_ID=" SD_MESSAGE_SESSION_START_STR, "SESSION_ID=%s", s->id, "USER_ID=%s", s->user->name, "LEADER="PID_FMT, s->leader, @@ -617,12 +617,10 @@ int session_start(Session *s) { /* Send signals */ session_send_signal(s, true); - user_send_changed(s->user, "Sessions", "Display", NULL); + user_send_changed(s->user, "Display", NULL); if (s->seat) { if (s->seat->active == s) - seat_send_changed(s->seat, "Sessions", "ActiveSession", NULL); - else - seat_send_changed(s->seat, "Sessions", NULL); + seat_send_changed(s->seat, "ActiveSession", NULL); } return 0; @@ -720,7 +718,7 @@ int session_finalize(Session *s) { if (s->started) log_struct(s->class == SESSION_BACKGROUND ? LOG_DEBUG : LOG_INFO, - LOG_MESSAGE_ID(SD_MESSAGE_SESSION_STOP), + "MESSAGE_ID=" SD_MESSAGE_SESSION_STOP_STR, "SESSION_ID=%s", s->id, "USER_ID=%s", s->user->name, "LEADER="PID_FMT, s->leader, @@ -750,11 +748,10 @@ int session_finalize(Session *s) { seat_set_active(s->seat, NULL); seat_save(s->seat); - seat_send_changed(s->seat, "Sessions", NULL); } user_save(s->user); - user_send_changed(s->user, "Sessions", "Display", NULL); + user_send_changed(s->user, "Display", NULL); return 0; } @@ -1257,7 +1254,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; @@ -1289,11 +1286,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);