Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-02-01 11:46:48 +0300
committerCorinna Vinschen <corinna@vinschen.de>2011-02-01 11:46:48 +0300
commit0e126cb141e7c9d3d8d8704bc31b3470d46acd0b (patch)
treef4a43a6feaed77899ab2d14c427d3f82de36b74d /winsup
parent2daa7e07cea5fb92a97d4d25c62c3f301523eab0 (diff)
* fhandler.cc (fhandler_base::fsync): Ignore ERROR_INVALID_FUNCTION
error from FlushFileBuffers().
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler.cc9
2 files changed, 13 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index fb21b9dbd..72ea9ad7b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-01 Christian Franke <franke@computer.org>
+
+ * fhandler.cc (fhandler_base::fsync): Ignore ERROR_INVALID_FUNCTION
+ error from FlushFileBuffers().
+
2011-01-31 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (utmp_data): Fix potential buffer overflow.
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;
}