[systemd-commits] TODO src/core src/login src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Fri Feb 7 10:27:09 PST 2014


 TODO                    |    2 ++
 src/core/dbus-scope.c   |   11 ++++++++++-
 src/login/logind-dbus.c |    3 ++-
 src/shared/bus-errors.h |    1 +
 4 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 4e2f8d27781731021aa6b96c0ee18a8966eefe1c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 7 17:59:27 2014 +0100

    core: when an already abandoned unit gets abandoned again generate a clean error

diff --git a/TODO b/TODO
index 57e82ff..b9a0f0f 100644
--- a/TODO
+++ b/TODO
@@ -36,6 +36,8 @@ External:
 
 Features:
 
+* nspawn: rename --file-label to --apifs-label
+
 * hookup nspawn and PrivateNetwork=yes with "ip netns"
 
 * socket units: support creating sockets in different namespace,
diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c
index c46c972..d025696 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);
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 30476f3..651bd80 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -2384,7 +2384,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;
                 }
diff --git a/src/shared/bus-errors.h b/src/shared/bus-errors.h
index e9ab731..5637935 100644
--- a/src/shared/bus-errors.h
+++ b/src/shared/bus-errors.h
@@ -37,6 +37,7 @@
 #define BUS_ERROR_JOB_TYPE_NOT_APPLICABLE "org.freedesktop.systemd1.JobTypeNotApplicable"
 #define BUS_ERROR_NO_ISOLATION "org.freedesktop.systemd1.NoIsolation"
 #define BUS_ERROR_SHUTTING_DOWN "org.freedesktop.systemd1.ShuttingDown"
+#define BUS_ERROR_SCOPE_NOT_RUNNING "org.freedesktop.systemd1.ScopeNotRunning"
 
 #define BUS_ERROR_NO_SUCH_MACHINE "org.freedesktop.machine1.NoSuchMachine"
 #define BUS_ERROR_NO_MACHINE_FOR_PID "org.freedesktop.machine1.NoMachineForPID"



More information about the systemd-commits mailing list