]> Savannah Git Hosting - gnulib.git/commitdiff
fsync: Avoid test failure on native Windows.
authorBruno Haible <bruno@clisp.org>
Sat, 4 Feb 2012 13:59:43 +0000 (14:59 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 4 Feb 2012 13:59:43 +0000 (14:59 +0100)
* lib/fsync.c (fsync) [Windows]: Don't fail if the handle is merely
read-only.

ChangeLog
lib/fsync.c

index b0b03aef81e0a23aa4c46653dc05abfde2ff70c6..e7cd49737ba7abf45f09bffac00f392a5c263065 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-02-04  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        sys_select: Avoid syntax error on OpenBSD 5.0.
index 20508c9cf9cd50a345a29d0c1787cf2c908d2e0e..c0b447c755affffb1644c7d8c8000dbd8e59268d 100644 (file)
@@ -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;