summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHartmut Holzgraefe <hholzgra@php.net>2000-03-17 12:41:55 +0000
committerHartmut Holzgraefe <hholzgra@php.net>2000-03-17 12:41:55 +0000
commit1e0b71df1fae4f000bd13a913c456371c6ef3c92 (patch)
treed6752a154d4c09af3d5994d43d3879291054fcf9
parent959a55078033177edb9fac3dfe868afad3509a86 (diff)
downloadphp-git-1e0b71df1fae4f000bd13a913c456371c6ef3c92.tar.gz
is_executable() for root fixed
this is an intermediate patch, switching from stat() to access() for is_(readable|writable|executable) shall fix the whole topic once and for all
-rw-r--r--ext/standard/filestat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index ef41fa6a39..1542f27501 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -102,6 +102,8 @@
#define getuid() 1
#endif
+#define S_IXROOT ( S_IXUSR | S_IXGRP | S_IXOTH )
+
PHP_RINIT_FUNCTION(filestat)
{
BLS_FETCH();
@@ -531,7 +533,7 @@ static void php_stat(const char *filename, int type, pval *return_value)
if(getuid()==0) RETURN_LONG(1); /* root */
RETURN_LONG((BG(sb).st_mode&rmask)!=0);
case 11: /*is executable*/
- if(getuid()==0) RETURN_LONG(1); /* root */
+ if(getuid()==0) xmask = S_IXROOT; /* root */
RETURN_LONG((BG(sb).st_mode&xmask)!=0 && !S_ISDIR(BG(sb).st_mode));
case 12: /*is file*/
RETURN_LONG(S_ISREG(BG(sb).st_mode));