logind: wait for the user service to finish startup before completing login attempt

This commit is contained in:
Lennart Poettering
2014-01-09 06:51:09 +08:00
parent f37925e02f
commit dd9b67aa3e
2 changed files with 20 additions and 3 deletions
+14
View File
@@ -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);
}
+6 -3
View File
@@ -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;