[uclibc-ng-devel] bugfix renameat2 wrong implement.

Message ID 1536816852-10981-1-git-send-email-ren_guo@c-sky.com
State New
Headers show
Series
  • [uclibc-ng-devel] bugfix renameat2 wrong implement.
Related show

Commit Message

Guo Ren Sept. 13, 2018, 5:34 a.m.
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
---
 libc/sysdeps/linux/common/rename.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/libc/sysdeps/linux/common/rename.c b/libc/sysdeps/linux/common/rename.c
index 30a4ed7..613ae4e 100644
--- a/libc/sysdeps/linux/common/rename.c
+++ b/libc/sysdeps/linux/common/rename.c
@@ -20,7 +20,9 @@  int rename(const char *oldpath, const char *newpath)
 # include <fcntl.h>
 int rename(const char *oldpath, const char *newpath)
 {
-	_syscall2(int, renameat2, const char *, oldpath, const char *, newpath)
+	_syscall5(int, renameat2, int, olddfd, const char *, oldpath,
+		  int, newdfd, const char *, newpath, int, flags)
+	return renameat2(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
 }
 #else
 _syscall2(int, rename, const char *, oldpath, const char *, newpath)