mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-18 06:03:42 +03:00
Merge pull request #14164 from poettering/exec-start-transient-fix
fix ExecStart= line generation for transient units
This commit is contained in:
commit
6cf5c3318f
@ -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;
|
||||
|
||||
fprintf(f, "%s=%s@%s %s\n", name, exec_chars, p, a);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
r = fflush_and_check(f);
|
||||
|
Loading…
x
Reference in New Issue
Block a user