diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-02-07 17:59:27 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-02-07 19:26:49 +0100 |
commit | 4e2f8d27781731021aa6b96c0ee18a8966eefe1c (patch) | |
tree | 81368613a20cc05e97175c9c3fe7c9513f02ca09 /src/core/dbus-scope.c | |
parent | ba4c5d93b73ef7bba0ae0c6bf2b36a42360f7a34 (diff) |
core: when an already abandoned unit gets abandoned again generate a clean error
Diffstat (limited to 'src/core/dbus-scope.c')
-rw-r--r-- | src/core/dbus-scope.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c index c46c972c26..d02569608c 100644 --- a/src/core/dbus-scope.c +++ b/src/core/dbus-scope.c @@ -27,15 +27,24 @@ #include "dbus-scope.h" #include "bus-util.h" #include "bus-internal.h" +#include "bus-errors.h" static int bus_scope_abandon(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { Scope *s = userdata; + int r; assert(bus); assert(message); assert(s); - return scope_abandon(s); + r = scope_abandon(s); + if (sd_bus_error_is_set(error)) + return r; + + if (r == -ESTALE) + return sd_bus_error_setf(error, BUS_ERROR_SCOPE_NOT_RUNNING, "Scope %s is not running, cannot abandon.", UNIT(s)->id); + + return sd_bus_reply_method_return(message, NULL); } static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, scope_result, ScopeResult); |