← Commit list

984b45142

Glenn L McGrath
Glenn L McGrath
2003-10-29
FAILED Duration: 90s

Subject

fix a bug where `which' doesn't check whether the file passed as an argument is a regular file, patch by Arthur Othieno

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

debianutils/which.c+3 -1
@@ -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;