[PATCH] Linux: Only define OPEN_TREE_* macros in <sys/mount.h> if undefined (bug 33921)
Carlos O'Donell
carlos@redhat.com
Wed Mar 4 14:22:07 GMT 2026
On 3/4/26 6:34 AM, Adhemerval Zanella Netto wrote:
>
>
> On 04/03/26 06:54, Florian Weimer wrote:
>> There is a conditional inclusion of <linux/mount.h> earlier in the file.
>> If that defines the macros, do not redefine them. This addresses build
>> problems as the token sequence used by the UAPI macro definitions
>> changes between Linux versions.
>
> LGTM, thanks.
>
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Thanks for fixing this!
I had a temporary hack in my tree for this.
>>
>> ---
>> sysdeps/unix/sysv/linux/sys/mount.h | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
>> index 5e496caf2f..0c5ebed33a 100644
>> --- a/sysdeps/unix/sysv/linux/sys/mount.h
>> +++ b/sysdeps/unix/sysv/linux/sys/mount.h
>> @@ -264,14 +264,16 @@ enum fsconfig_command
>> #define FSOPEN_CLOEXEC 0x00000001
>>
>> /* open_tree flags. */
>> -#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
>> +#ifndef OPEN_TREE_CLONE
>> +# define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
>> +#endif
>> #ifndef O_CLOEXEC
>> # include <bits/cloexec.h>
>> # define O_CLOEXEC __O_CLOEXEC
>> #endif
>> -#undef OPEN_TREE_CLOEXEC
>> -#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
>> -
>> +#ifndef OPEN_TREE_CLOEXEC
>> +# define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
>> +#endif
>>
>> __BEGIN_DECLS
>>
>>
>> base-commit: 7053778703f8de2488789a002d093247d2626921
>>
>
--
Cheers,
Carlos.
More information about the Libc-alpha
mailing list