diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-05-20 22:36:22 +0200 |
---|---|---|
committer | Evgeny Vereshchagin <evvers@ya.ru> | 2016-05-20 23:36:22 +0300 |
commit | 76736280668df164b867bb6c7c86588d0ec2cda1 (patch) | |
tree | df323a803347853867fe6ac8e0275782598964ca | |
parent | e4de3d23bbadfa4004f9c8e431c4011102ea42c1 (diff) |
Revert "core/dbus: further simplify branch code" (#3307)
-rw-r--r-- | src/core/dbus-execute.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 3be88ddf90..06943c6365 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -836,9 +836,11 @@ int bus_exec_context_set_transient_property( return r; if (mode != UNIT_CHECK) { - r = free_and_strdup(&c->user, uu); - if (r < 0) - return r; + + if (isempty(uu)) + c->user = mfree(c->user); + else if (free_and_strdup(&c->user, uu) < 0) + return -ENOMEM; unit_write_drop_in_private_format(u, mode, name, "User=%s\n", uu); } @@ -853,9 +855,11 @@ int bus_exec_context_set_transient_property( return r; if (mode != UNIT_CHECK) { - r = free_and_strdup(&c->group, gg); - if (r < 0) - return r; + + if (isempty(gg)) + c->group = mfree(c->group); + else if (free_and_strdup(&c->group, gg) < 0) + return -ENOMEM; unit_write_drop_in_private_format(u, mode, name, "Group=%s\n", gg); } @@ -869,9 +873,11 @@ int bus_exec_context_set_transient_property( return r; if (mode != UNIT_CHECK) { - r = free_and_strdup(&c->syslog_identifier, id); - if (r < 0) - return r; + + if (isempty(id)) + c->syslog_identifier = mfree(c->syslog_identifier); + else if (free_and_strdup(&c->syslog_identifier, id) < 0) + return -ENOMEM; unit_write_drop_in_private_format(u, mode, name, "SyslogIdentifier=%s\n", id); } @@ -1088,9 +1094,10 @@ int bus_exec_context_set_transient_property( return r; if (mode != UNIT_CHECK) { - r = free_and_strdup(&c->utmp_id, id); - if (r < 0) - return r; + if (isempty(id)) + c->utmp_id = mfree(c->utmp_id); + else if (free_and_strdup(&c->utmp_id, id) < 0) + return -ENOMEM; unit_write_drop_in_private_format(u, mode, name, "UtmpIdentifier=%s\n", strempty(id)); } @@ -1125,9 +1132,10 @@ int bus_exec_context_set_transient_property( return r; if (mode != UNIT_CHECK) { - r = free_and_strdup(&c->pam_name, n); - if (r < 0) - return r; + if (isempty(n)) + c->pam_name = mfree(c->pam_name); + else if (free_and_strdup(&c->pam_name, n) < 0) + return -ENOMEM; unit_write_drop_in_private_format(u, mode, name, "PAMName=%s\n", strempty(n)); } |