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';
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to