From 44924db3793d9312f5c99d224b1db7aa02f1905d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 8 Jan 2025 00:32:23 -0800 Subject: [PATCH] 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 --- ChangeLog | 8 ++++++++ lib/fcntl.in.h | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac8d573988..78e467bed8 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-05 Bruno Haible sigsegv tests: Work around a longjmp bug on GNU/Hurd. diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 1465ce594d..c63017634b 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -1,6 +1,6 @@ /* Like , 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 -- 2.39.5