path-util: make find_executable() work without /proc mounted

Follow-up for 888f65ace6.

Hopefully fixes #20514.
This commit is contained in:
Yu Watanabe
2021-08-24 02:04:24 +09:00
parent ded8039abe
commit 93413acd3e
+5 -1
View File
@@ -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)