Index: uspace/lib/posix/stdio.c
===================================================================
--- uspace/lib/posix/stdio.c	(revision fd4b636273574a853b74eb9da858127c5c14a66b)
+++ uspace/lib/posix/stdio.c	(revision 58115ae14b062b9ca747c251e60ba19fc8f37a74)
@@ -693,14 +693,30 @@
 
 /**
- * Remove a file.
+ * Remove a file or directory.
  *
  * @param path Pathname of the file that shall be removed.
- * @return Zero on success, -1 otherwise.
+ * @return Zero on success, -1 (with errno set) otherwise.
  */
 int posix_remove(const char *path)
 {
-	// FIXME: unlink() and rmdir() seem to be equivalent at the moment,
-	//        but that does not have to be true forever
-	return unlink(path);
+	struct stat st;
+	int rc = stat(path, &st);
+	
+	if (rc != EOK) {
+		errno = -rc;
+		return -1;
+	}
+	
+	if (st.is_directory) {
+		rc = rmdir(path);
+	} else {
+		rc = unlink(path);
+	}
+	
+	if (rc != EOK) {
+		errno = -rc;
+		return -1;
+	}
+	return 0;
 }
 
Index: uspace/lib/posix/unistd.c
===================================================================
--- uspace/lib/posix/unistd.c	(revision fd4b636273574a853b74eb9da858127c5c14a66b)
+++ uspace/lib/posix/unistd.c	(revision 58115ae14b062b9ca747c251e60ba19fc8f37a74)
@@ -176,4 +176,20 @@
 		return rc;
 	}
+}
+
+/**
+ * Remove a directory.
+ *
+ * @param path Directory pathname.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_rmdir(const char *path)
+{
+	int rc = rmdir(path);
+	if (rc != EOK) {
+		errno = -rc;
+		return -1;
+	}
+	return 0;
 }
 
Index: uspace/lib/posix/unistd.h
===================================================================
--- uspace/lib/posix/unistd.h	(revision fd4b636273574a853b74eb9da858127c5c14a66b)
+++ uspace/lib/posix/unistd.h	(revision 58115ae14b062b9ca747c251e60ba19fc8f37a74)
@@ -73,4 +73,5 @@
 
 /* Deleting Files */
+extern int posix_rmdir(const char *path);
 extern int posix_unlink(const char *path);
 
@@ -156,4 +157,5 @@
 	#define read posix_read
 
+	#define rmdir posix_rmdir
 	#define unlink posix_unlink
 
