From aca82e0ebadc48cc63fba4f71664b9b297733db2 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Jan 2021 04:10:42 +0100 Subject: [PATCH] use renameat2 syscall, when renameat isn't available --- libc/sysdeps/linux/common/renameat.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libc/sysdeps/linux/common/renameat.c b/libc/sysdeps/linux/common/renameat.c index b0b91fa3e..0156981de 100644 --- a/libc/sysdeps/linux/common/renameat.c +++ b/libc/sysdeps/linux/common/renameat.c @@ -6,12 +6,18 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include #include +#include +#include +#include +int +renameat (int oldfd, const char *old, int newfd, const char *new) +{ #ifdef __NR_renameat -_syscall4(int, renameat, int, oldfd, const char *, old, int, newfd, const char *, new) -libc_hidden_def(renameat) + return INLINE_SYSCALL (renameat, 4, oldfd, old, newfd, new); #else -/* should add emulation with rename() and /proc/self/fd/ ... */ + return INLINE_SYSCALL (renameat2, 5, oldfd, old, newfd, new, 0); #endif +} +libc_hidden_def (renameat) -- 2.11.4.GIT