Browse Source

rmdir: Use unlinkat if arch does not have the rmdir syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Markos Chandras 12 years ago
parent
commit
98f53c5760
1 changed files with 8 additions and 0 deletions
  1. 8 0
      libc/sysdeps/linux/common/rmdir.c

+ 8 - 0
libc/sysdeps/linux/common/rmdir.c

@@ -11,5 +11,13 @@
 #include <unistd.h>
 
 
+#if defined __NR_unlinkat && !defined __NR_rmdir
+# include <fcntl.h>
+int rmdir(const char *pathname)
+{
+	return unlinkat(AT_FDCWD, pathname, AT_REMOVEDIR);
+}
+#else
 _syscall1(int, rmdir, const char *, pathname)
+#endif
 libc_hidden_def(rmdir)