X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-dbus.c;h=235b1313d470d3f19f7739a2c1cf35b5aaaf572b;hb=f39d4a08e746e703d562076a0f622eb91dbdcd3e;hp=30476f3ea4455a8f9d9ed7d376e066768d775b8f;hpb=ba4c5d93b73ef7bba0ae0c6bf2b36a42360f7a34;p=elogind.git diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 30476f3ea..235b1313d 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -939,7 +939,7 @@ static int method_terminate_session(sd_bus *bus, sd_bus_message *message, void * if (!session) return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name); - r = session_stop(session); + r = session_stop(session, true); if (r < 0) return r; @@ -964,7 +964,7 @@ static int method_terminate_user(sd_bus *bus, sd_bus_message *message, void *use if (!user) return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid); - r = user_stop(user); + r = user_stop(user, true); if (r < 0) return r; @@ -989,7 +989,7 @@ static int method_terminate_seat(sd_bus *bus, sd_bus_message *message, void *use if (!seat) return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", name); - r = seat_stop_sessions(seat); + r = seat_stop_sessions(seat, true); if (r < 0) return r; @@ -1337,6 +1337,9 @@ static int execute_shutdown_or_sleep( m->action_job = c; m->action_what = w; + /* Make sure the lid switch is ignored for a while */ + manager_set_lid_switch_ignore(m, now(CLOCK_MONOTONIC) + IGNORE_LID_SWITCH_SUSPEND_USEC); + return 0; } @@ -1477,6 +1480,8 @@ static int method_do_shutdown_or_sleep( action_multiple_sessions, interactive, error, method, m); if (r < 0) return r; + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ } if (blocked) { @@ -1484,6 +1489,8 @@ static int method_do_shutdown_or_sleep( action_ignore_inhibit, interactive, error, method, m); if (r < 0) return r; + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ } if (!multiple_sessions && !blocked) { @@ -1491,6 +1498,8 @@ static int method_do_shutdown_or_sleep( action, interactive, error, method, m); if (r < 0) return r; + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ } r = bus_manager_shutdown_or_sleep_now_or_later(m, unit_name, w, error); @@ -2047,7 +2056,8 @@ int match_properties_changed(sd_bus *bus, sd_bus_message *message, void *userdat r = unit_name_from_dbus_path(path, &unit); if (r < 0) - return r; + /* quietly ignore non-units paths */ + return r == -EINVAL ? 0 : r; session = hashmap_get(m->session_units, unit); if (session) @@ -2191,11 +2201,11 @@ int manager_start_scope( r = sd_bus_message_new_method_call( manager->bus, + &m, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", - "StartTransientUnit", - &m); + "StartTransientUnit"); if (r < 0) return r; @@ -2362,7 +2372,6 @@ int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, c } int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *error) { - _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; _cleanup_free_ char *path = NULL; int r; @@ -2384,7 +2393,8 @@ int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *err NULL); if (r < 0) { if (sd_bus_error_has_name(error, BUS_ERROR_NO_SUCH_UNIT) || - sd_bus_error_has_name(error, BUS_ERROR_LOAD_FAILED)) { + sd_bus_error_has_name(error, BUS_ERROR_LOAD_FAILED) || + sd_bus_error_has_name(error, BUS_ERROR_SCOPE_NOT_RUNNING)) { sd_bus_error_free(error); return 0; }