cvs: php4 /ext/standard filestat.c
| From: | Sterling Hughes | Date: | Sat, 06 Oct 2001 18:52:37 +0000 |
| Subject: | cvs: php4 /ext/standard filestat.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7703@lists.php.net to get a copy of this message | ||
sterling Sat Oct 6 14:52:37 2001 EDT
Modified files:
/php4/ext/standard filestat.c
Log:
@ Don't through a file does not exist warning for the is_dir(), is_writeable(),
@ is_readable(), is_executable(), is_link() and is_file() functions. (Sterling)
Index: php4/ext/standard/filestat.c
diff -u php4/ext/standard/filestat.c:1.82 php4/ext/standard/filestat.c:1.83
--- php4/ext/standard/filestat.c:1.82 Tue Sep 25 17:58:23 2001
+++ php4/ext/standard/filestat.c Sat Oct 6 14:52:37 2001
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filestat.c,v 1.82 2001/09/25 21:58:23 jeroen Exp $ */
+/* $Id: filestat.c,v 1.83 2001/10/06 18:52:37 sterling Exp $ */
#include "php.h"
#include "safe_mode.h"
@@ -118,7 +118,8 @@
return SUCCESS;
}
-PHP_RSHUTDOWN_FUNCTION(filestat) {
+PHP_RSHUTDOWN_FUNCTION(filestat)
+{
if (BG(CurrentStatFile)) {
efree (BG(CurrentStatFile));
}
@@ -549,6 +550,7 @@
/* }}} */
#define IS_LINK_OPERATION() (type == 8 /* filetype */ || type == 14 /* is_link */ || type == 16 /*
lstat */)
+#define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t)
== FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK)
/* {{{ php_stat
*/
@@ -578,7 +580,7 @@
BG(lsb).st_mode = 0; /* mark lstat buf invalid */
#endif
if (VCWD_STAT(BG(CurrentStatFile), &BG(sb)) == -1) {
- if (!IS_LINK_OPERATION() && (type != FS_EXISTS || errno != ENOENT)) { /* fileexists()
test must print no error */
+ if (!(IS_LINK_OPERATION() && IS_EXISTS_CHECK(type)) || errno != ENOENT) { /*
fileexists() test must print no error */
php_error(E_WARNING, "stat failed for %s (errno=%d - %s)", BG(CurrentStatFile),
errno, strerror(errno));
}
efree(BG(CurrentStatFile));