cvs: /php4/ext/standard filestat.c
| From: | Hartmut Holzgraefe | Date: | Fri, 17 Mar 2000 12:42:25 +0000 |
| Subject: | cvs: /php4/ext/standard filestat.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12316@lists.php.net to get a copy of this message | ||
hholzgra Fri Mar 17 04:42:25 2000 EDT
Modified files:
/php4/ext/standard filestat.c
Log:
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
Index: php4/ext/standard/filestat.c
diff -u php4/ext/standard/filestat.c:1.28 php4/ext/standard/filestat.c:1.29
--- php4/ext/standard/filestat.c:1.28 Wed Mar 15 03:52:07 2000
+++ php4/ext/standard/filestat.c Fri Mar 17 04:41:55 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filestat.c,v 1.28 2000/03/15 11:52:07 rubys Exp $ */
+/* $Id: filestat.c,v 1.29 2000/03/17 12:41:55 hholzgra Exp $ */
#include "php.h"
#include "safe_mode.h"
@@ -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 @@
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));