1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

Add renameat2 function [BZ #17662]

The implementation falls back to renameat if renameat2 is not available
in the kernel (or in the kernel headers) and the flags argument is zero.
Without kernel support, a non-zero argument returns EINVAL, not ENOSYS.
This mirrors what the kernel does for invalid renameat2 flags.
This commit is contained in:
Florian Weimer
2018-07-05 18:59:02 +02:00
parent 1002d70823
commit d6da5cb6a8
45 changed files with 400 additions and 5 deletions

View File

@ -22,7 +22,7 @@
/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */
int
renameat (int oldfd, const char *old, int newfd, const char *new)
__renameat (int oldfd, const char *old, int newfd, const char *new)
{
if ((oldfd < 0 && oldfd != AT_FDCWD) || (newfd < 0 && newfd != AT_FDCWD))
{
@ -40,5 +40,6 @@ renameat (int oldfd, const char *old, int newfd, const char *new)
return -1;
}
libc_hidden_def (__renameat)
weak_alias (__renameat, renameat)
stub_warning (renameat)