summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-02-06 17:52:41 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-02-06 17:58:52 +0100
commit64242fd307ed007ca18cd8a37250ff900d87bfb8 (patch)
treed3ad4798fd3a6f831c4d9a07e186eb401288bce6 /src
parentcore/dbus-service: write PIDFile= setting to transient unit file (diff)
downloadsystemd-64242fd307ed007ca18cd8a37250ff900d87bfb8.tar.xz
systemd-64242fd307ed007ca18cd8a37250ff900d87bfb8.zip
core/dbus-service: empty assignment to PIDFile= resets the value
Follow-up for a9353a5c5b512f107955e56a9812724f40b841d3.
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus-service.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 10470a3f70..0904cc09c0 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -320,32 +320,34 @@ static int bus_service_set_transient_property(
if (r < 0)
return r;
- n = path_make_absolute(v, u->manager->prefix[EXEC_DIRECTORY_RUNTIME]);
- if (!n)
- return -ENOMEM;
+ if (!isempty(v)) {
+ n = path_make_absolute(v, u->manager->prefix[EXEC_DIRECTORY_RUNTIME]);
+ if (!n)
+ return -ENOMEM;
- path_simplify(n, true);
+ path_simplify(n, true);
- if (!path_is_normalized(n))
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "PIDFile= path '%s' is not valid", n);
+ if (!path_is_normalized(n))
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "PIDFile= path '%s' is not valid", n);
- e = path_startswith(n, "/var/run/");
- if (e) {
- char *z;
+ e = path_startswith(n, "/var/run/");
+ if (e) {
+ char *z;
- z = strjoin("/run/", e);
- if (!z)
- return log_oom();
+ z = strjoin("/run/", e);
+ if (!z)
+ return log_oom();
- if (!UNIT_WRITE_FLAGS_NOOP(flags))
- log_unit_notice(u, "Transient unit's PIDFile= property references path below legacy directory /var/run, updating %s → %s; please update client accordingly.", n, z);
+ if (!UNIT_WRITE_FLAGS_NOOP(flags))
+ log_unit_notice(u, "Transient unit's PIDFile= property references path below legacy directory /var/run, updating %s → %s; please update client accordingly.", n, z);
- free_and_replace(n, z);
+ free_and_replace(n, z);
+ }
}
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
free_and_replace(s->pid_file, n);
- unit_write_settingf(u, flags, name, "%s=%s", name, s->pid_file);
+ unit_write_settingf(u, flags, name, "%s=%s", name, strempty(s->pid_file));
}
return 1;