- int fd = open(wxFNCONV(szFileName),
- O_WRONLY | O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL)
- ACCESS(accessMode));
-
+#if defined(__WXMAC__) && !defined(__UNIX__)
+ // Dominic Mazzoni [dmazzoni+@cs.cmu.edu] reports that open is still broken on the mac, so we replace
+ // int fd = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access);
+ int fd = creat(wxUnix2MacFilename( szFileName ), accessMode);
+#else
+ int fd = wxOpen(wxFNCONV(szFileName),
+ O_BINARY | O_WRONLY | O_CREAT |
+ (bOverwrite ? O_TRUNC : O_EXCL)
+ ACCESS(accessMode));
+#endif