summaryrefslogtreecommitdiff
path: root/Zend/zend_stream.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2008-03-21 18:15:43 +0000
committerMarcus Boerger <helly@php.net>2008-03-21 18:15:43 +0000
commitadaf6daa3cfb28ece02cf897041c09aea363075c (patch)
treef4b1faf3481007aa7ccdbc9dd797b759b3b4d1f4 /Zend/zend_stream.c
parent9f001a01a14c54771998c95bde4df98a03044f2f (diff)
downloadphp-git-adaf6daa3cfb28ece02cf897041c09aea363075c.tar.gz
- Fix streams handling logic, only real FPs can be mmaped here
Diffstat (limited to 'Zend/zend_stream.c')
-rw-r--r--Zend/zend_stream.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
index 4ca0c818d3..84096879b7 100644
--- a/Zend/zend_stream.c
+++ b/Zend/zend_stream.c
@@ -154,6 +154,7 @@ static size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t
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 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t
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 */