From 12bd475135bb1157514540c39c5c6076f74070f9 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 23 Aug 2021 06:16:48 +0900 Subject: [PATCH] path-util: make find_executable() work without /proc mounted Hopefully fixes #20514. --- src/basic/path-util.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/basic/path-util.c b/src/basic/path-util.c index d11f254a9f6af..a21981616b596 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -630,7 +630,11 @@ static int check_x_access(const char *path, int *ret_fd) { return r; r = access_fd(fd, X_OK); - if (r < 0) + if (r == -ENOSYS) { + /* /proc is not mounted. Fallback to access(). */ + if (access(path, X_OK) < 0) + return -errno; + } else if (r < 0) return r; if (ret_fd)