diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-08-23 06:16:48 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-08-24 02:04:24 +0900 |
commit | 93413acd3ef3a637a0f31a1d133b103e1dc81fd6 (patch) | |
tree | ef66940aaaf412a9b38065213efee8db6814d90f | |
parent | ded8039abe2fa39add817871841e587ccd476197 (diff) | |
download | systemd-93413acd3ef3a637a0f31a1d133b103e1dc81fd6.tar.gz |
path-util: make find_executable() work without /proc mounted
Follow-up for 888f65ace6296ed61285d31db846babf1c11885e.
Hopefully fixes #20514.
-rw-r--r-- | src/basic/path-util.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c index d11f254a9f..a21981616b 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) |