From: Bruno Haible <bruno@clisp.org>
Date: Sun, 15 Sep 2019 16:32:54 +0000 (+0200)
Subject: fcntl-h: Fix compilation error of creat.c on MSVC.
X-Git-Tag: v1.0~4656
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7ed78c9f539e6981b7ba48ef2962d4364cbd37fc;p=gnulib.git

fcntl-h: Fix compilation error of creat.c on MSVC.

* lib/fcntl.in.h: Include <io.h> also when __need_system_fcntl_h is
defined.
---

diff --git a/ChangeLog b/ChangeLog
index 1c7ca6b238..84d9508c1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-09-15  Bruno Haible  <bruno@clisp.org>
+
+	fcntl-h: Fix compilation error of creat.c on MSVC.
+	* lib/fcntl.in.h: Include <io.h> also when __need_system_fcntl_h is
+	defined.
+
 2019-09-15  Bruno Haible  <bruno@clisp.org>
 
 	creat: Add tests.
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 557e6c14b2..abe7993e21 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -39,6 +39,12 @@
 #endif
 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
 
+/* Native Windows platforms declare open(), creat() in <io.h>.  */
+#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
+    && (defined _WIN32 && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 #else
 /* Normal invocation convention.  */
 
@@ -59,6 +65,12 @@
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
 
+/* Native Windows platforms declare open(), creat() in <io.h>.  */
+#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
+    && (defined _WIN32 && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 #ifndef _@GUARD_PREFIX@_FCNTL_H
 #define _@GUARD_PREFIX@_FCNTL_H
 
@@ -66,12 +78,6 @@
 # include <unistd.h>
 #endif
 
-/* Native Windows platforms declare open(), creat() in <io.h>.  */
-#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
-    && (defined _WIN32 && ! defined __CYGWIN__)
-# include <io.h>
-#endif
-
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */