projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6530f0d
)
fix a bug where `which' doesn't check whether the file passed as an argument
author
Glenn L McGrath
<bug1@ihug.co.nz>
Wed, 29 Oct 2003 04:50:35 +0000
(
04:50
-0000)
committer
Glenn L McGrath
<bug1@ihug.co.nz>
Wed, 29 Oct 2003 04:50:35 +0000
(
04:50
-0000)
is a regular file, patch by Arthur Othieno
debianutils/which.c
patch
|
blob
|
history
diff --git
a/debianutils/which.c
b/debianutils/which.c
index 27646d520a43784767bc8f93215418e63bd7be49..120f1e72f216e76dc6a97193b2500cef1376603b 100644
(file)
--- 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;