which: check AT_EACCESS
A file is executable only if the effective user have permission to execute it. The real user's permissions do not matter. Signed-off-by: Mattias Andrée <maandree@kth.se>
This commit is contained in:
parent
be34c4a24d
commit
7315b8686f
2
which.c
2
which.c
|
@ -20,7 +20,7 @@ canexec(int fd, const char *name)
|
||||||
|
|
||||||
if (fstatat(fd, name, &st, 0) < 0 || !S_ISREG(st.st_mode))
|
if (fstatat(fd, name, &st, 0) < 0 || !S_ISREG(st.st_mode))
|
||||||
return 0;
|
return 0;
|
||||||
return faccessat(fd, name, X_OK, 0) == 0;
|
return faccessat(fd, name, X_OK, AT_EACCESS) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue
Block a user