diff options
author | Glenn L McGrath | 2003-10-29 04:50:35 +0000 |
---|---|---|
committer | Glenn L McGrath | 2003-10-29 04:50:35 +0000 |
commit | 984b45142a1771edcd28c9f7e2fa3269e7e2dde3 (patch) | |
tree | 47837c591b1d7bb50b9f1107bad4151f9b5c4a75 /debianutils | |
parent | 6530f0d3a19857f28f7e1620062a354d82fc6c9c (diff) | |
download | busybox-984b45142a1771edcd28c9f7e2fa3269e7e2dde3.zip busybox-984b45142a1771edcd28c9f7e2fa3269e7e2dde3.tar.gz |
fix a bug where `which' doesn't check whether the file passed as an argument
is a regular file, patch by Arthur Othieno
Diffstat (limited to 'debianutils')
-rw-r--r-- | debianutils/which.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/debianutils/which.c b/debianutils/which.c index 27646d5..120f1e7 100644 --- a/debianutils/which.c +++ b/debianutils/which.c @@ -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; |