summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-09 06:45:38 +0800
committerLennart Poettering <lennart@poettering.net>2014-01-09 06:51:09 +0800
commitdd9b67aa3e9476b3a4b3e231006eea6d108c841f (patch)
treeefcaf687b195ad798d95a86da546d96bec6619d6
parentf37925e02f562d0f705be29ec31b0053ce6f7afa (diff)
logind: wait for the user service to finish startup before completing login attempt
-rw-r--r--src/login/logind-dbus.c14
-rw-r--r--src/login/logind-session-dbus.c9
2 files changed, 20 insertions, 3 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 08510b5ecc..2c86b9fa26 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1971,6 +1971,20 @@ int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_b
user->slice_job = NULL;
}
+ LIST_FOREACH(sessions_by_user, session, user->sessions) {
+ if (!session->started)
+ continue;
+
+ if (streq(result, "done"))
+ session_send_create_reply(session, NULL);
+ else {
+ _cleanup_bus_error_free_ sd_bus_error e = SD_BUS_ERROR_NULL;
+
+ sd_bus_error_setf(&e, BUS_ERROR_JOB_FAILED, "Start job for unit %s failed with '%s'", unit, result);
+ session_send_create_reply(session, &e);
+ }
+ }
+
user_save(user);
user_add_to_gc_queue(user);
}
diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
index f1905e93f3..54ad827feb 100644
--- a/src/login/logind-session-dbus.c
+++ b/src/login/logind-session-dbus.c
@@ -647,13 +647,16 @@ int session_send_create_reply(Session *s, sd_bus_error *error) {
assert(s);
- /* This is called after the session scope was successfully
- * created, and finishes where bus_manager_create_session()
- * left off. */
+ /* This is called after the session scope and the user service
+ * were successfully created, and finishes where
+ * bus_manager_create_session() left off. */
if (!s->create_message)
return 0;
+ if (!sd_bus_error_is_set(error) && (s->scope_job || s->user->service_job))
+ return 0;
+
c = s->create_message;
s->create_message = NULL;