cvs: php4 /main streams.c
| From: | Sascha Schumann | Date: | Fri, 04 Oct 2002 19:48:59 +0000 |
| Subject: | cvs: php4 /main streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-14549@lists.php.net to get a copy of this message | ||
sas Fri Oct 4 15:48:59 2002 EDT
Modified files:
/php4/main streams.c
Log:
Fix EOF cases
Noticed by: Ilia
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.94 php4/main/streams.c:1.95
--- php4/main/streams.c:1.94 Fri Oct 4 15:36:09 2002
+++ php4/main/streams.c Fri Oct 4 15:48:59 2002
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.94 2002/10/04 19:36:09 sas Exp $ */
+/* $Id: streams.c,v 1.95 2002/10/04 19:48:59 sas Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -656,6 +656,7 @@
PHPAPI char *_php_stream_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC)
{
size_t avail = 0;
+ int did_copy = 0;
if (maxlen == 0)
return NULL;
@@ -704,6 +705,7 @@
buf += cpysz;
maxlen -= cpysz;
+ did_copy = 1;
if (done) {
break;
}
@@ -720,6 +722,9 @@
}
}
}
+
+ if (!did_copy)
+ return NULL;
buf[0] = '\0';