]> granicus.if.org Git - php/commitdiff
Potential fix for Bug#18022:
authorWez Furlong <wez@php.net>
Sun, 25 Aug 2002 11:02:05 +0000 (11:02 +0000)
committerWez Furlong <wez@php.net>
Sun, 25 Aug 2002 11:02:05 +0000 (11:02 +0000)
Streams that are pipes on systems that HAVE_FLUSHIO should not be seeked
as is required for plain files on those systems.

main/streams.c

index 38bf8dae32db0f9f21d54836825ad4856fab99e5..71d823df815831acfeb9fcf049f97bb027485833 100755 (executable)
@@ -774,7 +774,7 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count
        assert(data != NULL);
 
 #if HAVE_FLUSHIO
-       if (data->last_op == 'r') {
+       if (!data->is_pipe && data->last_op == 'r') {
                fseek(data->file, 0, SEEK_CUR);
        }
        data->last_op = 'w';
@@ -798,7 +798,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
        }
 
 #if HAVE_FLUSHIO
-       if (data->last_op == 'w')
+       if (!data->is_pipe && data->last_op == 'w')
                fseek(data->file, 0, SEEK_CUR);
        data->last_op = 'r';
 #endif
@@ -856,7 +856,7 @@ static char *php_stdiop_gets(php_stream *stream, char *buf, size_t size TSRMLS_D
 
        assert(data != NULL);
 #if HAVE_FLUSHIO
-       if (data->last_op == 'w') {
+       if (!data->is_pipe && data->last_op == 'w') {
                fseek(data->file, 0, SEEK_CUR);
        }
        data->last_op = 'r';