Index: php_stream_mmap.h =================================================================== RCS file: /repository/php-src/main/streams/php_stream_mmap.h,v retrieving revision 1.5 diff -u -r1.5 php_stream_mmap.h --- php_stream_mmap.h 3 Aug 2005 14:08:42 -0000 1.5 +++ php_stream_mmap.h 30 Dec 2005 12:27:22 -0000 @@ -49,7 +49,7 @@ /* requested offset and length. * If length is 0, the whole file is mapped */ size_t offset; - size_t length; + ssize_t length; php_stream_mmap_access_t mode; Index: plain_wrapper.c =================================================================== RCS file: /repository/php-src/main/streams/plain_wrapper.c,v retrieving revision 1.52.2.3 diff -u -r1.52.2.3 plain_wrapper.c --- plain_wrapper.c 23 Dec 2005 14:32:11 -0000 1.52.2.3 +++ plain_wrapper.c 30 Dec 2005 12:27:23 -0000 @@ -609,7 +609,7 @@ case PHP_STREAM_MMAP_MAP_RANGE: do_fstat(data, 1); - if (range->length == 0 || range->length > data->sb.st_size) { + if (range->length <= 0 || range->length > data->sb.st_size) { range->length = data->sb.st_size; } switch (range->mode) { Index: streams.c =================================================================== RCS file: /repository/php-src/main/streams/streams.c,v retrieving revision 1.82.2.3 diff -u -r1.82.2.3 streams.c --- streams.c 23 Dec 2005 14:32:11 -0000 1.82.2.3 +++ streams.c 30 Dec 2005 12:27:24 -0000 @@ -1314,6 +1314,7 @@ if (p) { haveread = php_stream_write(dest, p, mapped); + php_stream_seek(src, haveread, SEEK_CUR); php_stream_mmap_unmap(src);