]> granicus.if.org Git - php/commitdiff
is_executable() for root fixed
authorHartmut Holzgraefe <hholzgra@php.net>
Fri, 17 Mar 2000 12:41:55 +0000 (12:41 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Fri, 17 Mar 2000 12:41:55 +0000 (12:41 +0000)
this is an intermediate patch, switching from stat() to
access() for is_(readable|writable|executable) shall
fix the whole topic once and for all

ext/standard/filestat.c

index ef41fa6a3907064e16a9f6af7ec1f099b97bbc3c..1542f27501e0bd2936327ec6a7f9b8491ca7178c 100644 (file)
 #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));