X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/686a3ee080e7b5f17a3d1dbd688602f7f4bcf22a..27c78e4552aaefac9a4db0d4453eff09cdfef2ad:/src/common/file.cpp diff --git a/src/common/file.cpp b/src/common/file.cpp index 9985b9d448..a6aa633b5a 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -14,10 +14,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "file.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -334,17 +330,18 @@ size_t wxFile::Write(const void *pBuf, size_t nCount) // flush bool wxFile::Flush() { - if ( IsOpened() ) { -#if defined(__VISUALC__) || wxHAVE_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; }