summaryrefslogtreecommitdiff
path: root/src/core/dbus-execute.c
diff options
context:
space:
mode:
authorJonathan Boulle <jonathanboulle@gmail.com>2016-05-20 16:20:00 +0200
committerLennart Poettering <lennart@poettering.net>2016-05-20 16:20:00 +0200
commit4e282d11b7f4d08c85b8b80b055b3c92f6714ee1 (patch)
tree7a6e6bd7195a17f5831db9d316a0b2a29f1f6872 /src/core/dbus-execute.c
parent6f270e6bd8b78aedf9f77534d6d11141ea0bf8ca (diff)
core/dbus: revert oversimplification (#3309)
free_and_strdup handles NULL but not empty strings. See also: https://github.com/systemd/systemd/pull/3283#issuecomment-220603145 https://github.com/systemd/systemd/pull/3307
Diffstat (limited to 'src/core/dbus-execute.c')
-rw-r--r--src/core/dbus-execute.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 888319593c..3be88ddf90 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -1454,9 +1454,10 @@ int bus_exec_context_set_transient_property(
return r;
if (mode != UNIT_CHECK) {
- r = free_and_strdup(&c->selinux_context, s);
- if (r < 0)
- return r;
+ if (isempty(s))
+ c->selinux_context = mfree(c->selinux_context);
+ else if (free_and_strdup(&c->selinux_context, s) < 0)
+ return -ENOMEM;
unit_write_drop_in_private_format(u, mode, name, "%s=%s\n", name, strempty(s));
}