[BusyBox-cvs] busybox/debianutils which.c,1.5,1.6
Glenn McGrath
bug1 at busybox.net
Wed Oct 29 04:50:39 UTC 2003
Update of /var/cvs/busybox/debianutils
In directory winder:/tmp/cvs-serv16974/debianutils
Modified Files:
which.c
Log Message:
fix a bug where `which' doesn't check whether the file passed as an argument
is a regular file, patch by Arthur Othieno
Index: which.c
===================================================================
RCS file: /var/cvs/busybox/debianutils/which.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- which.c 22 Oct 2003 11:36:55 -0000 1.5
+++ which.c 29 Oct 2003 04:50:35 -0000 1.6
@@ -30,7 +30,9 @@
{
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;
More information about the busybox-cvs
mailing list