From 1e0b71df1fae4f000bd13a913c456371c6ef3c92 Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Fri, 17 Mar 2000 12:41:55 +0000 Subject: [PATCH] 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 --- ext/standard/filestat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)); -- 2.50.1