]> Savannah Git Hosting - gnulib.git/commitdiff
fcntl-h: Fix GNULIB_defined_O_NONBLOCK on Haiku (regr. 2025-02-16).
authorBruno Haible <bruno@clisp.org>
Wed, 12 Mar 2025 10:52:05 +0000 (11:52 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 12 Mar 2025 10:58:18 +0000 (11:58 +0100)
* lib/fcntl.in.h (_@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H): New macro.

ChangeLog
lib/fcntl.in.h

index 20b40fa74f4b5b10f4a0d8ebcf10f287f0bc11cf..0d363007b7c90a2a6278659fd7f1efb1884e2513 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-03-12  Bruno Haible  <bruno@clisp.org>
+
+       fcntl-h: Fix GNULIB_defined_O_NONBLOCK on Haiku (regr. 2025-02-16).
+       * lib/fcntl.in.h (_@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H): New macro.
+
 2025-03-12  Simon Josefsson  <simon@josefsson.org>
 
        doc: Improvements for gnulib git bundle.
index ac61c0865a499afffc2fd6718c646d6c0882697d..d7f551b30f3f2a0fa57c1b10c12f4eea41a9b89e 100644 (file)
 #endif
 @PRAGMA_COLUMNS@
 
-#if defined __need_system_fcntl_h
-/* Special invocation convention.  */
+#if defined __need_system_fcntl_h || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+/* Special invocation convention:
+   - On Haiku we have a sequence of nested includes
+       <fcntl.h> -> <unistd.h> -> <fcntl.h>
+     In this situation, GNULIB_defined_O_NONBLOCK gets defined before the
+     system's definition of O_NONBLOCK is processed.  */
 
 /* Needed before <sys/stat.h>.
    May also define off_t to a 64-bit type on native Windows.  */
@@ -50,6 +54,8 @@
 
 #ifndef _@GUARD_PREFIX@_FCNTL_H
 
+#define _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+
 /* Needed before <sys/stat.h>.
    May also define off_t to a 64-bit type on native Windows.
    Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku.  */
@@ -72,6 +78,8 @@
 # include <io.h>
 #endif
 
+#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+
 #ifndef _@GUARD_PREFIX@_FCNTL_H
 #define _@GUARD_PREFIX@_FCNTL_H