From: Paul Eggert Date: Wed, 8 Jan 2025 08:32:23 +0000 (-0800) Subject: fcntl-h: port better to musl on GNU/Linux X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=0fb185b7cd5ee44ae4921e8a1a38468fbee43b43;p=gnulib.git 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 --- diff --git a/ChangeLog b/ChangeLog index 2acacb69a2..39e35c04a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-01-08 Paul Eggert + + 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-06 Collin Funk servent tests: Fix mistake in previous commit. diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 5f06c4fe10..ac61c0865a 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -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