Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 86cf96db61d51787a47d6d8c6ac8e3d1961b743d)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 03289871c675b83ed939beb60680fb3245e1eea6)
@@ -27,4 +27,5 @@
  */
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -131,5 +132,5 @@
 static unsigned int rm_single(const char *path)
 {
-	if (unlink(path)) {
+	if (unlink(path) != 0) {
 		cli_error(CL_EFAIL, "rm: could not remove file %s", path);
 		return 1;
@@ -150,5 +151,5 @@
 
 	fd = open(path, O_RDONLY);
-	if (fd > 0) {
+	if (fd >= 0) {
 		close(fd);
 		return RM_FILE;
@@ -210,5 +211,5 @@
 	rc = rmdir(path);
 	if (rc == 0)
-		return ret;
+		return errno;
 
 	cli_error(CL_ENOTSUP, "Can not remove %s", path);
