summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2012-10-10 15:05:37 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2013-02-20 13:45:11 +0100
commit98f53c576045dbc85525ca39a913f078f84ec35d (patch)
treea89be3d887153438af9c27b4fc4d99c81a50168c
parentc4c78fc5f3c945e2a755e184d8c7e2dab7f8fe4e (diff)
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>
-rw-r--r--libc/sysdeps/linux/common/rmdir.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/rmdir.c b/libc/sysdeps/linux/common/rmdir.c
index bad66544b..d534b40b1 100644
--- a/libc/sysdeps/linux/common/rmdir.c
+++ b/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)