On 09/16/2011 02:37 PM, Bruno Haible wrote:
The original intent of that code was to test the behaviour of fsync on a
read-only file descriptor, and STDIN_FILENO is one. Why should it be better
to test STDOUT_FILENO?
Why not test both? Like this proposed patch. (Which also add blank
lines as separators, to make the test more readable.)
Looks good to me. Maybe we should also test reopening file in O_RDONLY
mode, since fsync on a tty is much different than fsync on a regular file.
POSIX requires fsync to work on read-only regular files, but I'm not
sure if all implementations support that (if they don't, we could
probably fake it by doing a no-op; read-only files can't be changing
anything but atime metadata, which isn't the end of the world if it is
not sync'd).
--
Eric Blake ebl...@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org