]> granicus.if.org Git - php/commitdiff
stdio buffers data in user land. By calling fflush(3), this
authorSascha Schumann <sas@php.net>
Mon, 7 Oct 2002 03:12:06 +0000 (03:12 +0000)
committerSascha Schumann <sas@php.net>
Mon, 7 Oct 2002 03:12:06 +0000 (03:12 +0000)
data is sent to the kernel using write(2). fsync'ing a
file descriptor is not required -- writing to a fd has the same
affect as calling fflush after each fwrite.

main/streams.c

index 4eb73e1ae95c79bd8cc859d3d6615dd3ef9b7474..475a4bbc2f09286bb2063f6ee471c7d17ef5c024 100755 (executable)
@@ -1280,11 +1280,15 @@ static int php_stdiop_flush(php_stream *stream TSRMLS_DC)
 
        assert(data != NULL);
 
-       if (data->fd >= 0) {
-               return fsync(data->fd);
-       } else {
+       /*
+        * stdio buffers data in user land. By calling fflush(3), this
+        * data is send to the kernel using write(2). fsync'ing is
+        * something completely different.
+        */
+       if (data->fd < 0) {
                return fflush(data->file);
        }
+       return 0;
 }
 
 static int php_stdiop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC)