#ifdef HAVE_CYGWIN
-#include <fcntl.h>
-#include <stdlib.h>
+#if defined(open) && open == binary_open
+# undef open
+#endif
+#if defined(pipe) && open == binary_pipe
+# undef pipe
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/utsname.h>
#include <sys/vfs.h>
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <windows.h>
+
#include "xmalloc.h"
#define is_winnt (GetVersion() < 0x80000000)
#define ntsec_off(c) ((c) && strstr((c),"nontsec"))
#define ntea_on(c) ((c) && strstr((c),"ntea") && !strstr((c),"nontea"))
-#if defined(open) && open == binary_open
-# undef open
-#endif
-#if defined(pipe) && open == binary_pipe
-# undef pipe
-#endif
-
int
binary_open(const char *filename, int flags, ...)
{