diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-09-01 03:30:59 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-09-01 03:30:59 +0200 |
commit | 8f6df3fa98ee74eaf5c34dddd272d2e3c10c3c27 (patch) | |
tree | 5fec4954f329146a2d6952e16e1319ba5bb1b2af /src/dbus.c | |
parent | aabd9b11ba563e1d988b119960c94b139ec5de00 (diff) |
dbus: don't accept activation requests anymore if we are going down anyway
Diffstat (limited to 'src/dbus.c')
-rw-r--r-- | src/dbus.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/dbus.c b/src/dbus.c index 952806bb2a..8c969eab63 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -43,6 +43,7 @@ #include "dbus-timer.h" #include "dbus-path.h" #include "bus-errors.h" +#include "special.h" #define CONNECTIONS_MAX 52 @@ -383,13 +384,19 @@ static DBusHandlerResult api_bus_message_filter(DBusConnection *connection, DBus log_debug("Got D-Bus activation request for %s", name); - r = manager_load_unit(m, name, NULL, &error, &u); + if (manager_unit_pending_inactive(m, SPECIAL_DBUS_SERVICE) || + manager_unit_pending_inactive(m, SPECIAL_DBUS_SOCKET)) { + r = -EADDRNOTAVAIL; + dbus_set_error(&error, BUS_ERROR_SHUTTING_DOWN, "Refusing activation, D-Bus is shutting down."); + } else { + r = manager_load_unit(m, name, NULL, &error, &u); - if (r >= 0 && u->meta.refuse_manual_start) - r = -EPERM; + if (r >= 0 && u->meta.refuse_manual_start) + r = -EPERM; - if (r >= 0) - r = manager_add_job(m, JOB_START, u, JOB_REPLACE, true, &error, NULL); + if (r >= 0) + r = manager_add_job(m, JOB_START, u, JOB_REPLACE, true, &error, NULL); + } if (r < 0) { const char *id, *text; |