diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-11-24 00:44:57 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-12-14 00:54:13 +0100 |
commit | 4ea0d7f431ad036608020a78d8f8a00c414fe693 (patch) | |
tree | 23ee99aa61e342dc0d643e3fc3940b0aee225867 /src/core | |
parent | d2d6c096f6373a76f3b303a7a116e7cfe7139c4d (diff) |
core: make "Restart" service property accessible via the transient API
Fixes: #4402
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/dbus-service.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index 61b83d2d62..85b67318ed 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -143,6 +143,29 @@ static int bus_service_set_transient_property( return 1; + } else if (streq(name, "Restart")) { + ServiceRestart sr; + const char *v; + + r = sd_bus_message_read(message, "s", &v); + if (r < 0) + return r; + + if (isempty(v)) + sr = SERVICE_RESTART_NO; + else { + sr = service_restart_from_string(v); + if (sr < 0) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid restart setting: %s", v); + } + + if (mode != UNIT_CHECK) { + s->restart = sr; + unit_write_drop_in_private_format(UNIT(s), mode, name, "Restart=%s", service_restart_to_string(sr)); + } + + return 1; + } else if (STR_IN_SET(name, "StandardInputFileDescriptor", "StandardOutputFileDescriptor", |