cvs: ZendEngine2(PHP_5_3) / zend_stream.c

[email protected] ("Marcus Boerger")
Newsgroups php.zend-engine.cvs
Message-ID <cvshelly1206123343@cvsserver>
helly		Fri Mar 21 18:15:43 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /ZendEngine2	zend_stream.c 
  Log:
  - Fix streams handling logic, only real FPs can be mmaped here
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_stream.c?r1=1.13.2.1.2.1.2.2&r2=1.13.2.1.2.1.2.3&diff_format=u
Index: ZendEngine2/zend_stream.c
diff -u ZendEngine2/zend_stream.c:1.13.2.1.2.1.2.2 ZendEngine2/zend_stream.c:1.13.2.1.2.1.2.3
--- ZendEngine2/zend_stream.c:1.13.2.1.2.1.2.2	Sun Mar 16 21:05:33 2008
+++ ZendEngine2/zend_stream.c	Fri Mar 21 18:15:43 2008
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_stream.c,v 1.13.2.1.2.1.2.2 2008/03/16 21:05:33 helly Exp $ */
+/* $Id: zend_stream.c,v 1.13.2.1.2.1.2.3 2008/03/21 18:15:43 helly Exp $ */
 
 
 #include "zend.h"
@@ -154,6 +154,7 @@
 ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len TSRMLS_DC) /* {{{ */
 {
 	size_t size;
+	zend_stream_type old_type;
 
 	if (file_handle->type == ZEND_HANDLE_FILENAME) {
 		if (zend_stream_open(file_handle->filename, file_handle TSRMLS_CC) == FAILURE) {
@@ -196,9 +197,10 @@
 		return FAILURE;
 	}
 
+	old_type = file_handle->type;
 	file_handle->type = ZEND_HANDLE_STREAM;  /* we might still be _FP but we need fsize() work */
 
-	if (!file_handle->handle.stream.isatty && size) {
+	if (old_type == ZEND_HANDLE_FP && !file_handle->handle.stream.isatty && size) {
 #if HAVE_MMAP
 		if (file_handle->handle.fp && size) {
 			/*  *buf[size] is zeroed automatically by the kernel */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.