]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
analyze: resolve executable path if it is relative 18300/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 18 Jan 2021 19:40:26 +0000 (04:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 18 Jan 2021 21:39:25 +0000 (06:39 +0900)
Fixes #18252.

src/analyze/analyze-verify.c

index a9c89173bfa9997a66c48e215823e972bb104383..bf28624d41f6d0fe7bd136c33319dd2b07e56e09 100644 (file)
@@ -115,14 +115,17 @@ static int verify_socket(Unit *u) {
 }
 
 int verify_executable(Unit *u, const ExecCommand *exec) {
+        int r;
+
         if (!exec)
                 return 0;
 
         if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE)
                 return 0;
 
-        if (access(exec->path, X_OK) < 0)
-                return log_unit_error_errno(u, errno, "Command %s is not executable: %m", exec->path);
+        r = find_executable_full(exec->path, false, NULL, NULL);
+        if (r < 0)
+                return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);
 
         return 0;
 }