From: Bruno Haible Date: Sat, 4 Feb 2012 13:59:43 +0000 (+0100) Subject: fsync: Avoid test failure on native Windows. X-Git-Tag: v0.1~1177 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=c1bd375b4c5cbca0a7947c984e95f2cdd6a19456;p=gnulib.git fsync: Avoid test failure on native Windows. * lib/fsync.c (fsync) [Windows]: Don't fail if the handle is merely read-only. --- diff --git a/ChangeLog b/ChangeLog index b0b03aef8..e7cd49737 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2012-02-04 Bruno Haible + fsync: Avoid test failure on native Windows. + * lib/fsync.c (fsync) [Windows]: Don't fail if the handle is merely + read-only. + +2012-02-04 Bruno Haible + sys_select: Avoid syntax error on OpenBSD 5.0. * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is currently being included, just include the system's . diff --git a/lib/fsync.c b/lib/fsync.c index 20508c9cf..c0b447c75 100644 --- a/lib/fsync.c +++ b/lib/fsync.c @@ -57,6 +57,11 @@ fsync (int fd) err = GetLastError (); switch (err) { + case ERROR_ACCESS_DENIED: + /* For a read-only handle, fsync should succeed, even though we have + no way to sync the access-time changes. */ + return 0; + /* eg. Trying to fsync a tty. */ case ERROR_INVALID_HANDLE: errno = EINVAL;