]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
libio: Define AT_RENAME_* with the same tokens as Linux
authorFlorian Weimer <fweimer@redhat.com>
Fri, 5 Sep 2025 17:02:57 +0000 (19:02 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 5 Sep 2025 17:02:59 +0000 (19:02 +0200)
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>
libio/stdio.h
stdio-common/tst-renameat2.c

index d042b3661837dbe35676c93a951ad1a6677f9a11..e0e70945fab175fafcb0c8bbae96ad7eebe3df5a 100644 (file)
@@ -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.  */
index 12aa0f8b0f837a9341143d202a5be901d66bd741..6213e1376d5700417ef3f786e1f005b04d48982c 100644 (file)
 #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;