dmitry Fri Nov 10 10:55:43 2006 UTC
Modified files:
/php-src/main fopen_wrappers.c
/php-src/main/streams plain_wrapper.c
Log:
Removed unnecessary checks for ISREG file and corresponding stat() calls on
Wind
ows
http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?r1=1.185&r2=1.186&diff_format=u
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.185 php-src/main/fopen_wrappers.c:1.186
--- php-src/main/fopen_wrappers.c:1.185 Fri Nov 10 09:56:37 2006
+++ php-src/main/fopen_wrappers.c Fri Nov 10 10:55:43 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.185 2006/11/10 09:56:37 dmitry Exp $ */
+/* $Id: fopen_wrappers.c,v 1.186 2006/11/10 10:55:43 dmitry Exp $ */
/* {{{ includes
*/
@@ -263,7 +263,9 @@
PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
{
FILE *fp;
+#ifndef PHP_WIN32
struct stat st;
+#endif
char *path_info, *filename;
int length;
@@ -329,11 +331,14 @@
}
fp = VCWD_FOPEN(filename, "rb");
+#ifndef PHP_WIN32
/* refuse to open anything that is not a regular file */
if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
fclose(fp);
fp = NULL;
}
+#endif
+
if (!fp) {
STR_FREE(SG(request_info).path_translated); /* for same
reason as above */
SG(request_info).path_translated = NULL;
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.74&r2=1.75&diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.74
php-src/main/streams/plain_wrapper.c:1.75
--- php-src/main/streams/plain_wrapper.c:1.74 Thu Oct 19 09:49:56 2006
+++ php-src/main/streams/plain_wrapper.c Fri Nov 10 10:55:43 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c,v 1.74 2006/10/19 09:49:56 dmitry Exp $ */
+/* $Id: plain_wrapper.c,v 1.75 2006/11/10 10:55:43 dmitry Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -891,6 +891,8 @@
efree(persistent_id);
}
+ /* WIN32 always set ISREG flag */
+#ifndef PHP_WIN32
/* sanity checks for include/require.
* We check these after opening the stream, so that we
save
* on fstat() syscalls */
@@ -899,15 +901,12 @@
int r;
r = do_fstat(self, 0);
- if (
-#ifndef PHP_WIN32
- (r != 0) || /* it is OK for
fstat to fail under win32 */
-#endif
- (r == 0 &&
!S_ISREG(self->sb.st_mode))) {
+ if ((r == 0 && !S_ISREG(self->sb.st_mode))) {
php_stream_close(ret);
return NULL;
}
}
+#endif
return ret;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php