This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sync() on a read-only file handle doesn't work on cygwin either
authorTony Cook <tony@develop-help.com>
Tue, 17 Jul 2012 05:48:02 +0000 (15:48 +1000)
committerTony Cook <tony@develop-help.com>
Tue, 17 Jul 2012 05:48:02 +0000 (15:48 +1000)
Cygwin fsync() is implemented in terms of the Win32 FlushFileBuffers()
API which requires GENERIC_WRITE access.

dist/IO/t/io_xs.t

index 85fbc56..b731447 100644 (file)
@@ -45,7 +45,10 @@ SKIP:
        or skip "No fsync", 1;
     $^O eq 'aix'
       and skip "fsync() documented to fail on non-writable handles on AIX", 1;
+    $^O eq 'cygwin'
+      and skip "fsync() on cygwin uses FlushFileBuffers which requires a writable handle", 1;
     open my $fh, "<", "t/io_xs.t"
        or skip "Cannot open t/io_xs.t read-only: $!", 1;
-    ok($fh->sync, "sync to a read only handle");
+    ok($fh->sync, "sync to a read only handle")
+       or diag "sync(): ", $!;
 }