// 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"
wxLogSysError(_("can't create file '%s'"), szFileName);
return false;
}
- else
- {
- Attach(fd);
- return true;
- }
+
+ Attach(fd);
+ return true;
}
// open the file
wxLogSysError(_("can't open file '%s'"), szFileName);
return false;
}
- else {
- Attach(fd);
- return true;
- }
+
+ Attach(fd);
+ return true;
}
// close
// 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;
}