clean up sloppy nested inclusion from pthread_impl.h
[oweals/musl.git] / src / stdio / remove.c
index 8e338277eb967dcbac1f76f8d8994f8b47b8f668..e147ba251440d8e04d8585604c8190891b1643ac 100644 (file)
@@ -1,7 +1,9 @@
 #include <stdio.h>
+#include <errno.h>
 #include "syscall.h"
 
 int remove(const char *path)
 {
-       return __syscall_unlink(path);
+       int r = syscall(SYS_unlink, path);
+       return (r && errno == EISDIR) ? syscall(SYS_rmdir, path) : r;
 }