chiark / gitweb /
logind: wait for the user service to finish startup before completing login attempt
[elogind.git] / src / login / logind-dbus.c
index 7ece815155cc4c41d8b16b0b4674bfd9d0b20e25..2c86b9fa264d6ab7069b3e88ec4de9aedfb4811b 100644 (file)
@@ -495,7 +495,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
         else {
                 seat = hashmap_get(m->seats, cseat);
                 if (!seat)
-                        return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", seat);
+                        return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", cseat);
         }
 
         if (tty_is_vc(tty)) {
@@ -504,7 +504,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
                 if (!seat)
                         seat = m->seat0;
                 else if (seat != m->seat0)
-                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "TTY %s is virtual console but seat %s is not seat0", tty, seat);
+                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "TTY %s is virtual console but seat %s is not seat0", tty, seat->id);
 
                 v = vtnr_from_tty(tty);
                 if (v <= 0)
@@ -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);
         }