mirror of
https://git.busybox.net/busybox.git
synced 2024-11-24 14:13:26 +08:00
fix a bug where `which' doesn't check whether the file passed as an argument
is a regular file, patch by Arthur Othieno
This commit is contained in:
parent
6530f0d3a1
commit
984b45142a
@ -30,7 +30,9 @@ static int file_exists(char *file)
|
||||
{
|
||||
struct stat filestat;
|
||||
|
||||
if (stat(file, &filestat) == 0 && filestat.st_mode & S_IXUSR)
|
||||
if (stat(file, &filestat) == 0 &&
|
||||
S_ISREG(filestat.st_mode) &&
|
||||
filestat.st_mode & S_IXUSR)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user