summaryrefslogtreecommitdiffstats
path: root/usr/klibc/remove.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/remove.c')
-rw-r--r--usr/klibc/remove.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr/klibc/remove.c b/usr/klibc/remove.c
new file mode 100644
index 0000000..9088204
--- /dev/null
+++ b/usr/klibc/remove.c
@@ -0,0 +1,18 @@
+/*
+ * remove.c
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+int remove(const char *pathname)
+{
+ int rv;
+
+ rv = unlink(pathname);
+ if (rv == -1 && errno == EISDIR)
+ return rmdir(pathname);
+
+ return rv;
+}