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

Florian Weimer via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f053ff88a4add1339f0eae254eb6be058ce38f66

commit f053ff88a4add1339f0eae254eb6be058ce38f66
Author: Florian Weimer <[email protected]>
Date:   Wed Mar 4 18:32:36 2026 +0100

    Linux: Only define OPEN_TREE_* macros in <sys/mount.h> if undefined (bug 33921)
    
    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.
    
    Reviewed-by: Adhemerval Zanella  <[email protected]>
    (cherry picked from commit d12b017cddfeb9fe9920ba054ae3dfcb8e9238b8)

Diff:
---
 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 600ac455bc..1692965e53 100644
--- a/sysdeps/unix/sysv/linux/sys/mount.h
+++ b/sysdeps/unix/sysv/linux/sys/mount.h
@@ -261,14 +261,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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.