sas Sun Oct 6 23:12:06 2002 EDT Modified files: /php4/main streams.c Log: 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. Index: php4/main/streams.c diff -u php4/main/streams.c:1.98 php4/main/streams.c:1.99 --- php4/main/streams.c:1.98 Sun Oct 6 19:27:53 2002 +++ php4/main/streams.c Sun Oct 6 23:12:06 2002 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.98 2002/10/06 23:27:53 wez Exp $ */ +/* $Id: streams.c,v 1.99 2002/10/07 03:12:06 sas Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -1280,11 +1280,15 @@ 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)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php