[PATCH] Linux: Only define OPEN_TREE_* macros in <sys/mount.h> if undefined (bug 33921)

Florian Weimer fweimer@redhat.com
Wed Mar 4 09:54:49 GMT 2026


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.

---
 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



More information about the Libc-alpha mailing list