From: Hartmut Holzgraefe Date: Fri, 17 Mar 2000 12:41:55 +0000 (+0000) Subject: is_executable() for root fixed X-Git-Tag: PHP-4.0-RC1~97 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e0b71df1fae4f000bd13a913c456371c6ef3c92;p=php 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 --- 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));