diff options
author | Sascha Schumann <sas@php.net> | 2002-10-07 03:12:06 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2002-10-07 03:12:06 +0000 |
commit | 88b2d8bb8f56926805903fbd4bf2e53631fe728e (patch) | |
tree | a848312cc37eb40029cf056acbcef2f939e64484 /main/streams.c | |
parent | 2dde6fb594a1c90a30ecd0cda20e562e37ad58e9 (diff) | |
download | php-git-88b2d8bb8f56926805903fbd4bf2e53631fe728e.tar.gz |
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.
Diffstat (limited to 'main/streams.c')
-rwxr-xr-x | main/streams.c | 10 |
1 files 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) |