summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch
blob: fd7f94a61d56521ce2cc85a4ec5b93ce7ff4d40b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From b9b7a8e3825f0433e120f7a6d7d5d635a839cab9 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Thu, 21 Jan 2021 06:19:44 +0000
Subject: [PATCH] analyze: resolve executable path if it is relative

Upstream-Status: Backport [https://github.com/systemd/systemd/commit/f1fb046a985521f7d4a662f02546686ff20b7e5d]

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 src/analyze/analyze-verify.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c
index a9c89173bf..969523df18 100644
--- a/src/analyze/analyze-verify.c
+++ b/src/analyze/analyze-verify.c
@@ -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);
+        if (r < 0)
+                return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);
 
         return 0;
 }
-- 
2.26.2