summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index c97cc0139..02c285706 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1588,7 +1588,14 @@ fhandler_base::fsync ()
return 0;
if (FlushFileBuffers (get_handle ()))
return 0;
- __seterrno ();
+
+ /* Ignore ERROR_INVALID_FUNCTION because FlushFileBuffers() always fails
+ with this code on raw devices which are unbuffered by default. */
+ DWORD errcode = GetLastError();
+ if (errcode == ERROR_INVALID_FUNCTION)
+ return 0;
+
+ __seterrno_from_win_error (errcode);
return -1;
}