]> granicus.if.org Git - php/commitdiff
Backport from HEAD; set EOF marker after each read attempt to avoid it
authorWez Furlong <wez@php.net>
Wed, 8 Oct 2003 10:58:28 +0000 (10:58 +0000)
committerWez Furlong <wez@php.net>
Wed, 8 Oct 2003 10:58:28 +0000 (10:58 +0000)
being stuck in the on position.
Partial "fix" for #25649.

main/streams.c

index 5d81315642db69f266699e1db6891ae166bf9da1..4903d6e9e46019c7c6e77f6a420ec245c9507ac7 100755 (executable)
@@ -1460,8 +1460,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
        if (data->fd >= 0) {
                ret = read(data->fd, buf, count);
                
-               if (ret == 0 || (ret == -1 && errno != EWOULDBLOCK))
-                       stream->eof = 1;
+               stream->eof = (ret == 0 || (ret == -1 && errno != EWOULDBLOCK));
                                
        } else {
 #if HAVE_FLUSHIO
@@ -1472,8 +1471,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
 
                ret = fread(buf, 1, count, data->file);
 
-               if (feof(data->file))
-                       stream->eof = 1;
+               stream->eof = feof(data->file);
        }
        return ret < 0 ? 0 : ret;
 }