[PATCH v3 11/48] rmdir: Use unlinkat if arch does not have the rmdir syscall

Markos Chandras markos.chandras at gmail.com
Wed Jan 23 11:41:35 UTC 2013


From: Markos Chandras <markos.chandras at imgtec.com>

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>
---
 libc/sysdeps/linux/common/rmdir.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libc/sysdeps/linux/common/rmdir.c b/libc/sysdeps/linux/common/rmdir.c
index bad6654..4d12a22 100644
--- a/libc/sysdeps/linux/common/rmdir.c
+++ b/libc/sysdeps/linux/common/rmdir.c
@@ -8,8 +8,16 @@
  */
 
 #include <sys/syscall.h>
+#include <fcntl.h>
 #include <unistd.h>
 
 
+#if defined(__NR_unlinkat) && !defined(__NR_rmdir)
+int rmdir(const char *pathname)
+{
+	return unlinkat(AT_FDCWD, pathname, AT_REMOVEDIR);
+}
+#else
 _syscall1(int, rmdir, const char *, pathname)
+#endif
 libc_hidden_def(rmdir)
-- 
1.8.1.1




More information about the uClibc mailing list