pollita Wed Sep 8 14:45:05 2004 EDT
Modified files: (Branch: PHP_5_0)
/php-src/main/streams streams.c
Log:
MFH (r.163) Handle maxlen when stream can't be mmaped
http://cvs.php.net/diff.php/php-src/main/streams/streams.c?r1=1.61.2.1&r2=1.61.2.2&ty=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.61.2.1 php-src/main/streams/streams.c:1.61.2.2
--- php-src/main/streams/streams.c:1.61.2.1 Tue Aug 31 07:38:59 2004
+++ php-src/main/streams/streams.c Wed Sep 8 14:45:05 2004
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.61.2.1 2004/08/31 11:38:59 tony2001 Exp $ */
+/* $Id: streams.c,v 1.61.2.2 2004/09/08 18:45:05 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