pollita Wed Sep 8 14:42:15 2004 EDT Modified files: /php-src/main/streams streams.c Log: Handle maxlen when stream can't be mmaped http://cvs.php.net/diff.php/php-src/main/streams/streams.c?r1=1.62&r2=1.63&ty=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.62 php-src/main/streams/streams.c:1.63 --- php-src/main/streams/streams.c:1.62 Tue Aug 31 07:37:02 2004 +++ php-src/main/streams/streams.c Wed Sep 8 14:42:15 2004 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.62 2004/08/31 11:37:02 tony2001 Exp $ */ +/* $Id: streams.c,v 1.63 2004/09/08 18:42:15 pollita Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -1209,6 +1209,17 @@ return mapped; } + } + + if (maxlen > 0) { + ptr = *buf = pemalloc_rel_orig(maxlen + 1, persistent); + while ((len < maxlen) & !php_stream_eof(src)) { + ret = php_stream_read(src, ptr, maxlen - len); + len += ret; + ptr += ret; + } + *ptr = '\0'; + return len; } /* avoid many reallocs by allocating a good sized chunk to begin with, if
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php