diff options
| author | Sterling Hughes <sterling@php.net> | 2001-10-06 18:52:37 +0000 |
|---|---|---|
| committer | Sterling Hughes <sterling@php.net> | 2001-10-06 18:52:37 +0000 |
| commit | 1bceefb2da1208757331b972151e58ea3ed285d8 (patch) | |
| tree | b5fcb05bc132f2c81b3aa9884d5eaa170ab015c8 /ext | |
| parent | 2965b8c1fc0d1d9b482b9858682b7584755e1f95 (diff) | |
| download | php-git-1bceefb2da1208757331b972151e58ea3ed285d8.tar.gz | |
@ 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)
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/standard/filestat.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index d2a130ea27..905366c41b 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -118,7 +118,8 @@ PHP_RINIT_FUNCTION(filestat) return SUCCESS; } -PHP_RSHUTDOWN_FUNCTION(filestat) { +PHP_RSHUTDOWN_FUNCTION(filestat) +{ if (BG(CurrentStatFile)) { efree (BG(CurrentStatFile)); } @@ -549,6 +550,7 @@ PHP_FUNCTION(clearstatcache) /* }}} */ #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 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ 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)); |
