]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/run/run.c
Merge pull request #1668 from ssahani/net1
[thirdparty/systemd.git] / src / run / run.c
index 93d8cd1d08076ee8a83e21157bd41b1a2fac4e02..6d3e739882dbd277574bcbe00104288ecfb8787e 100644 (file)
@@ -30,6 +30,7 @@
 #include "calendarspec.h"
 #include "env-util.h"
 #include "event-util.h"
+#include "fd-util.h"
 #include "formats-util.h"
 #include "path-util.h"
 #include "ptyfwd.h"
@@ -1153,14 +1154,20 @@ int main(int argc, char* argv[]) {
         if (r <= 0)
                 goto finish;
 
-        if (argc > optind) {
-                r = find_binary(argv[optind], arg_transport == BUS_TRANSPORT_LOCAL, &command);
+        if (argc > optind && arg_transport == BUS_TRANSPORT_LOCAL) {
+                /* Patch in an absolute path */
+
+                r = find_binary(argv[optind], &command);
                 if (r < 0) {
-                        log_error_errno(r, "Failed to find executable %s%s: %m",
-                                        argv[optind],
-                                        arg_transport == BUS_TRANSPORT_LOCAL ? "" : " on local system");
+                        log_error_errno(r, "Failed to find executable %s: %m", argv[optind]);
+                        goto finish;
+                }
+                if (r == 0) {
+                        log_error("Couldn't find executable %s.", argv[optind]);
+                        r = -ENOENT;
                         goto finish;
                 }
+
                 argv[optind] = command;
         }