From 70d1747dd0fb31df780d2e0255a8e0417899b6ca Mon Sep 17 00:00:00 2001 From: Vitaly _Vi Shukela Date: Tue, 21 Feb 2023 00:23:45 +0100 Subject: [PATCH] expose renameat2 function if such syscall is available Does not include RENAME_EXCHANGE, RENAME_NOREPLACE or RENAME_WHITEOUT constants that are likely to be the reason to use renameat2 instead of renameat, but this should still simplify linking issues arising from the use of renameat2 and enable simpler workarounds. --- src/unistd/renameat.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/unistd/renameat.c b/src/unistd/renameat.c index c3b40a25..fe1adaf4 100644 --- a/src/unistd/renameat.c +++ b/src/unistd/renameat.c @@ -9,3 +9,10 @@ int renameat(int oldfd, const char *old, int newfd, const char *new) return syscall(SYS_renameat2, oldfd, old, newfd, new, 0); #endif } + +#ifdef SYS_renameat2 +int renameat2(int oldfd, const char *old, int newfd, const char *new, unsigned int flags) +{ + return syscall(SYS_renameat2, oldfd, old, newfd, new, flags); +} +#endif -- 2.39.1