]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dbus-scope: simplify bus_scope_set_transient_property()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 29 Dec 2017 08:08:22 +0000 (17:08 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 Jan 2018 17:23:38 +0000 (02:23 +0900)
src/core/dbus-scope.c

index 9195ad36d081a7a472cf5de8ab66aca59fb99074..a0c4a65b3346f7542c8cd98c7b8cae82a2440fff 100644 (file)
@@ -26,6 +26,7 @@
 #include "dbus-kill.h"
 #include "dbus-scope.h"
 #include "dbus-unit.h"
+#include "dbus-util.h"
 #include "dbus.h"
 #include "scope.h"
 #include "selinux-access.h"
@@ -84,6 +85,9 @@ static int bus_scope_set_transient_property(
 
         flags |= UNIT_PRIVATE;
 
+        if (streq(name, "TimeoutStopUSec"))
+                return bus_set_transient_usec(UNIT(s), name, &s->timeout_stop_usec, message, flags, error);
+
         if (streq(name, "PIDs")) {
                 unsigned n = 0;
                 uint32_t pid;
@@ -138,21 +142,6 @@ static int bus_scope_set_transient_property(
                                 return r;
                 }
 
-                return 1;
-
-        } else if (streq(name, "TimeoutStopUSec")) {
-                uint64_t t;
-
-                r = sd_bus_message_read(message, "t", &t);
-                if (r < 0)
-                        return r;
-
-                if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
-                        s->timeout_stop_usec = t;
-
-                        unit_write_settingf(UNIT(s), flags, name, "TimeoutStopSec=" USEC_FMT "us", t);
-                }
-
                 return 1;
         }