]> Savannah Git Hosting - gnulib.git/commitdiff
fcntl-h: port better to musl on GNU/Linux
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 8 Jan 2025 08:32:23 +0000 (00:32 -0800)
committerBruno Haible <bruno@clisp.org>
Sat, 18 Jan 2025 08:31:10 +0000 (09:31 +0100)
* lib/fcntl.in.h (O_SEARCH): Redefine to O_RDONLY on musl,
which mistakenly defines it to be O_PATH on GNU/Linux.
Problem reported by Lasse Collin in:
https://bugs.gnu.org/75405

ChangeLog
lib/fcntl.in.h

index ac8d573988ef9066215ede7234669d832bb38d2b..78e467bed8c524205f4b56fee7dd5f98212b2ce2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-01-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       fcntl-h: port better to musl on GNU/Linux
+       * lib/fcntl.in.h (O_SEARCH): Redefine to O_RDONLY on musl,
+       which mistakenly defines it to be O_PATH on GNU/Linux.
+       Problem reported by Lasse Collin in:
+       https://bugs.gnu.org/75405
+
 2025-01-05  Bruno Haible  <bruno@clisp.org>
 
        sigsegv tests: Work around a longjmp bug on GNU/Hurd.
index 1465ce594d7aedab9de984d9baceca5d9b06f0d8..c63017634b5adfc4008295e65d8d9365c6903a4e 100644 (file)
@@ -1,6 +1,6 @@
 /* Like <fcntl.h>, but with non-working flags defined to 0.
 
-   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+   Copyright (C) 2006-2025 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -369,8 +369,12 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
 # define O_RSYNC 0
 #endif
 
+#if defined O_SEARCH && defined O_PATH && O_SEARCH == O_PATH
+# undef O_SEARCH /* musl mistakenly #defines O_SEARCH to O_PATH.  */
+#endif
+
 #ifndef O_SEARCH
-# define O_SEARCH O_RDONLY /* This is often close enough in older systems.  */
+# define O_SEARCH O_RDONLY /* Often close enough in non-POSIX systems.  */
 #endif
 
 #ifndef O_SYNC