From: Jonathan Boulle Date: Fri, 20 May 2016 14:20:00 +0000 (+0200) Subject: core/dbus: revert oversimplification (#3309) X-Git-Tag: v231~279 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e282d11b7f4d08c85b8b80b055b3c92f6714ee1;p=platform%2Fupstream%2Fsystemd.git 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 --- diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 8883195..3be88dd 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)); }