Hash :
ec046e66
Author :
Date :
2017-07-27T12:08:39
renameat2: new module Although the Linux syscall renameat2 is not in glibc (yet?), it is useful to have access to its RENAME_NOREPLACE flag. * MODULES.html.sh (func_all_modules): Add renameat2. * lib/renameat2.c, lib/renameat2.h, modules/renameat2: * modules/renameat2-tests, tests/test-renameat2.c: New files. * lib/renameat.c (renameat): Move most of the implementation to renameat2, and just call renameat2. * modules/renameat (Files): Remove lib/at-func2.c. (Depends-on): Depend only on renameat2. (Include): Remove <fcntl.h>. * modules/renameat-tests (test_renameat_LDADD): Add $(LIB_EACCESS), since renameat (via renameat2) might use faccessat.
/* Rename a file relative to open directories.
Copyright 2017 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
#include "renameat2.h"
int
renameat (int fd1, char const *src, int fd2, char const *dst)
{
return renameat2 (fd1, src, fd2, dst, 0);
}