From 0fb0fffa09ec8b8c26b6c1a4876b47b2acdc8cce Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 29 Dec 2017 17:08:22 +0900 Subject: [PATCH] dbus-scope: simplify bus_scope_set_transient_property() --- src/core/dbus-scope.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c index 9195ad36d08..a0c4a65b334 100644 --- a/src/core/dbus-scope.c +++ b/src/core/dbus-scope.c @@ -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; }