]> git.saurik.com Git - wxWidgets.git/commitdiff
only call fsync() on disk files, otherwise we get an error for pipes under Unix
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 19 Sep 2005 23:34:07 +0000 (23:34 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 19 Sep 2005 23:34:07 +0000 (23:34 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/file.cpp

index d72e649bc8e3dac11d97369f25d3b244e6390914..ae71d0ef12bccbbbb051b3a930c48c0aa4c54512 100644 (file)
@@ -334,17 +334,18 @@ size_t wxFile::Write(const void *pBuf, size_t nCount)
 // flush
 bool wxFile::Flush()
 {
-    if ( IsOpened() ) {
 #if defined(__VISUALC__) || defined(HAVE_FSYNC)
+    // fsync() only works on disk files and returns errors for pipes, don't
+    // call it then
+    if ( IsOpened() && GetKind() == wxFILE_KIND_DISK )
+    {
         if ( wxFsync(m_fd) == -1 )
         {
             wxLogSysError(_("can't flush file descriptor %d"), m_fd);
             return false;
         }
-#else // no fsync
-        // just do nothing
-#endif // fsync
     }
+#endif // fsync
 
     return true;
 }