From 88b2d8bb8f56926805903fbd4bf2e53631fe728e Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Mon, 7 Oct 2002 03:12:06 +0000 Subject: [PATCH] stdio buffers data in user land. By calling fflush(3), this 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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/streams.c b/main/streams.c index 4eb73e1ae9..475a4bbc2f 100755 --- a/main/streams.c +++ b/main/streams.c @@ -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) -- 2.40.0