diff options
author | Michael Wallner <mike@php.net> | 2014-04-03 10:40:06 +0200 |
---|---|---|
committer | Michael Wallner <mike@php.net> | 2014-04-03 10:40:06 +0200 |
commit | d08b4dbf23febd3f305a2682b03ab9c70f11ac60 (patch) | |
tree | 0a11318a3992b8137b9f6bdd448596532f1d5b26 /main/streams/streams.c | |
parent | 7ab5c593f77b229210a88d436270707f74b22b78 (diff) | |
download | php-git-d08b4dbf23febd3f305a2682b03ab9c70f11ac60.tar.gz |
Fix Bug #66736 fpassthru broken
Diffstat (limited to 'main/streams/streams.c')
-rw-r--r-- | main/streams/streams.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c index acc67dc207..12833771c0 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1405,11 +1405,16 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC) p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped); if (p) { - PHPWRITE(p, mapped); + do { + /* output functions return int, so pass in int max */ + if (0 < (b = PHPWRITE(p, MIN(mapped - bcount, INT_MAX)))) { + bcount += b; + } + } while (b > 0 && mapped > bcount); php_stream_mmap_unmap_ex(stream, mapped); - return mapped; + return bcount; } } |