diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-20 15:26:19 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-20 15:26:19 +0200 |
commit | f73e8b9caffa1d9828f23d4d71f587fe47ffacb8 (patch) | |
tree | 878508f4bba6bb20abc16f528906784d0afd9bd5 /src/core/dbus-execute.c | |
parent | 14a081a0ff1db125ade7aea3540e5544fd3e57a9 (diff) | |
parent | e9876fc9c5aeec0144c15cd288852ea6c6ac8c29 (diff) |
Merge pull request #1616 from evverx/run-fix-environment-parsing
run: fix Environment parsing
Diffstat (limited to 'src/core/dbus-execute.c')
-rw-r--r-- | src/core/dbus-execute.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index a286149b53..20fefde62e 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -1155,18 +1155,24 @@ int bus_exec_context_set_transient_property( _cleanup_free_ char *joined = NULL; char **e; - e = strv_env_merge(2, c->environment, l); - if (!e) - return -ENOMEM; + if (strv_length(l) == 0) { + c->environment = strv_free(c->environment); + unit_write_drop_in_private_format(u, mode, name, "Environment=\n"); + } else { + e = strv_env_merge(2, c->environment, l); + if (!e) + return -ENOMEM; - strv_free(c->environment); - c->environment = e; + strv_free(c->environment); + c->environment = e; - joined = strv_join_quoted(c->environment); - if (!joined) - return -ENOMEM; + joined = strv_join_quoted(c->environment); + if (!joined) + return -ENOMEM; + + unit_write_drop_in_private_format(u, mode, name, "Environment=%s\n", joined); + } - unit_write_drop_in_private_format(u, mode, name, "Environment=%s\n", joined); } return 1; |