]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/file.cpp
Added simple instructions and autogen.mk to rebuild configure script.
[wxWidgets.git] / src / common / file.cpp
index 1e6f0e41e1a70f3bbd42ce17265dea3ee7a669cb..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__) || HAVE_FSYNC
+#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;
 }