diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-11-27 18:32:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-27 18:32:30 +0100 |
commit | 6cf5c3318f55dd1cee7efba190d5b4e3848e5ecb (patch) | |
tree | e1a71a2bfbbce2e2c62f3c04661138dbdbc0a420 /src | |
parent | Merge pull request #14145 from poettering/process-bypass (diff) | |
parent | core: prefer non-@ syntax for ExecStart= (diff) | |
download | systemd-6cf5c3318f55dd1cee7efba190d5b4e3848e5ecb.tar.xz systemd-6cf5c3318f55dd1cee7efba190d5b4e3848e5ecb.zip |
Merge pull request #14164 from poettering/exec-start-transient-fix
fix ExecStart= line generation for transient units
Diffstat (limited to 'src')
-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 13ff6f489a..1d0bc1ede3 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -1095,25 +1095,31 @@ int bus_set_transient_exec_command( if (!f) return -ENOMEM; - fputs("ExecStart=\n", f); + fprintf(f, "%s=\n", name); LIST_FOREACH(command, c, *exec_command) { - _cleanup_free_ char *a = NULL, *t = NULL, *exec_chars = NULL; - const char *p; + _cleanup_free_ char *a = NULL, *exec_chars = NULL; - p = unit_escape_setting(c->path, UNIT_ESCAPE_C|UNIT_ESCAPE_SPECIFIERS, &t); - if (!p) + exec_chars = exec_command_flags_to_exec_chars(c->flags); + if (!exec_chars) return -ENOMEM; a = unit_concat_strv(c->argv, UNIT_ESCAPE_C|UNIT_ESCAPE_SPECIFIERS); if (!a) return -ENOMEM; - exec_chars = exec_command_flags_to_exec_chars(c->flags); - if (!exec_chars) - return -ENOMEM; + if (streq_ptr(c->path, c->argv ? c->argv[0] : NULL)) + fprintf(f, "%s=%s%s\n", name, exec_chars, a); + else { + _cleanup_free_ char *t = NULL; + const char *p; + + p = unit_escape_setting(c->path, UNIT_ESCAPE_C|UNIT_ESCAPE_SPECIFIERS, &t); + if (!p) + return -ENOMEM; - fprintf(f, "%s=%s@%s %s\n", name, exec_chars, p, a); + fprintf(f, "%s=%s@%s %s\n", name, exec_chars, p, a); + } } r = fflush_and_check(f); |