aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2025-09-05 19:02:57 +0200
committerFlorian Weimer <fweimer@redhat.com>2025-09-05 19:02:59 +0200
commitb173557da978a04ac3bdfc0bd3b0e7ac583b44d5 (patch)
tree04efd920674244fb4fdaa6c4d644bea95936b94a
parent5d45da09e6bd0a66ec3b7aa9f279ee225dcbae52 (diff)
downloadglibc-b173557da978a04ac3bdfc0bd3b0e7ac583b44d5.zip
glibc-b173557da978a04ac3bdfc0bd3b0e7ac583b44d5.tar.gz
glibc-b173557da978a04ac3bdfc0bd3b0e7ac583b44d5.tar.bz2
libio: Define AT_RENAME_* with the same tokens as LinuxHEADmaster
Linux uses different expressions for the RENAME_* and AT_RENAME_* constants. Mirror that in <stdio.h>, so that the macro redefinitions do not result in preprocessor warnings. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
-rw-r--r--libio/stdio.h6
-rw-r--r--stdio-common/tst-renameat2.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/libio/stdio.h b/libio/stdio.h
index d042b36..e0e7094 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -168,11 +168,11 @@ extern int renameat (int __oldfd, const char *__old, int __newfd,
#ifdef __USE_GNU
/* Flags for renameat2. */
# define RENAME_NOREPLACE (1 << 0)
-# define AT_RENAME_NOREPLACE RENAME_NOREPLACE
+# define AT_RENAME_NOREPLACE 0x0001
# define RENAME_EXCHANGE (1 << 1)
-# define AT_RENAME_EXCHANGE RENAME_EXCHANGE
+# define AT_RENAME_EXCHANGE 0x0002
# define RENAME_WHITEOUT (1 << 2)
-# define AT_RENAME_WHITEOUT RENAME_WHITEOUT
+# define AT_RENAME_WHITEOUT 0x0004
/* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with
additional flags. */
diff --git a/stdio-common/tst-renameat2.c b/stdio-common/tst-renameat2.c
index 12aa0f8..6213e13 100644
--- a/stdio-common/tst-renameat2.c
+++ b/stdio-common/tst-renameat2.c
@@ -28,6 +28,12 @@
#include <support/xunistd.h>
#include <unistd.h>
+/* These constants are defined with different token sequences,
+ matching the Linux definitions, to avoid preprocessor warnings. */
+_Static_assert (RENAME_NOREPLACE == AT_RENAME_NOREPLACE, "RENAME_NOREPLACE");
+_Static_assert (RENAME_EXCHANGE == AT_RENAME_EXCHANGE, "RENAME_EXCHANGE");
+_Static_assert (RENAME_WHITEOUT == AT_RENAME_WHITEOUT, "RENAME_WHITEOUT");
+
/* Directory with the temporary files. */
static char *directory;
static int directory_fd;