On Thu, 09.04.15 15:20, Michal Sekletar (msekl...@redhat.com) wrote:

> +        quotes = chars_intersect(service, SHELL_NEED_QUOTES);
> +
> +        service_maybe_quoted = alloca(strlen(service) + 3);
> +        sprintf(service_maybe_quoted, "%s%s%s", quotes ? "'" : "",
> service, quotes ? "'" : "");

I have now added a new call to systemd git that properly prepares a
string for inclusion in a shell command line. It will not just enclose
the string in double quotes if necessary, but also escape all shell
special shell characters within it. It's called shell_maybe_quote(),
ad I ported the current code over to it, please use it for your new
code too!

Thanks,

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to