diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-08-31 20:28:09 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-09-09 13:49:29 -0400 |
commit | a6fde35332f5e7f78bff437d7b7bfded83debbaa (patch) | |
tree | a2433a8fbd4168a9bef60979da6c19a77f0459b4 /src/core/dbus-service.c | |
parent | a012ab5293a28af93454b3105ca85ca148b1c11f (diff) |
systemd-run: properly escape arguments
Spaces, quotes, and such, were not properly escaped. We should
write them like we read them.
https://bugs.freedesktop.org/show_bug.cgi?id=67971
Diffstat (limited to 'src/core/dbus-service.c')
-rw-r--r-- | src/core/dbus-service.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index 85b13f01ef..696c4462fe 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -273,21 +273,16 @@ static int bus_service_set_transient_property( fputs("ExecStart=\n", f); LIST_FOREACH(command, c, s->exec_command[SERVICE_EXEC_START]) { - char **a; - fputs("ExecStart=", f); + _cleanup_free_ char *a; - if (c->ignore) - fputc('-', f); - - fputc('@', f); - fputs(c->path, f); - - STRV_FOREACH(a, c->argv) { - fputc(' ', f); - fputs(*a, f); - } + a = strv_join_quoted(c->argv); + if (!a) + return -ENOMEM; - fputc('\n', f); + fprintf(f, "ExecStart=%s@%s %s\n", + c->ignore ? "-" : "", + c->path, + a); } fflush(f); |