]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/libsystemd/sd-bus/bus-util.c
util: add shell_maybe_quote() call for preparing a string for shell cmdline inclusion
[thirdparty/systemd.git] / src / libsystemd / sd-bus / bus-util.c
index 649876926076faf95a4fe87a13a744c14ac8deb9..45882abaad9456a21be0d259d3c92e0be264c40e 100644 (file)
@@ -1735,16 +1735,15 @@ static int check_wait_response(BusWaitForJobs *d, bool quiet) {
                 else if (streq(d->result, "unsupported"))
                         log_error("Operation on or unit type of %s not supported on this system.", strna(d->name));
                 else if (!streq(d->result, "done") && !streq(d->result, "skipped")) {
-                        if (d->name) {
-                                bool quotes;
+                        _cleanup_free_ char *quoted = NULL;
 
-                                quotes = chars_intersect(d->name, SHELL_NEED_QUOTES);
+                        if (d->name)
+                                quoted = shell_maybe_quote(d->name);
 
-                                log_error("Job for %s failed. See \"systemctl status %s%s%s\" and \"journalctl -xe\" for details.",
-                                          d->name,
-                                          quotes ? "'" : "", d->name, quotes ? "'" : "");
-                        } else
-                                log_error("Job failed. See \"journalctl -xe\" for details.");
+                        if (quoted)
+                                log_error("Job for %s failed. See 'systemctl status %s' and 'journalctl -xe' for details.", d->name, quoted);
+                        else
+                                log_error("Job failed. See 'journalctl -xe' for details.");
                 }
         }