[systemd-devel] [PATCH v2] log: be more verbose if dbus job fails

Lennart Poettering lennart at poettering.net
Thu Apr 9 09:36:10 PDT 2015


On Thu, 09.04.15 15:20, Michal Sekletar (msekleta at 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


More information about the systemd-devel mailing list