rename.c 530 B

12345678910111213141516171819202122
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * rename() for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <sys/syscall.h>
  10. #include <stdio.h>
  11. #include <unistd.h>
  12. #if defined __NR_renameat && !defined __NR_rename
  13. # include <fcntl.h>
  14. int rename(const char *oldpath, const char *newpath)
  15. {
  16. return renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath);
  17. }
  18. #else
  19. _syscall2(int, rename, const char *, oldpath, const char *, newpath)
  20. #endif