Browse Source

print error message for mount failure

K. Lange 2 years ago
parent
commit
6ec4f807e1
1 changed files with 6 additions and 3 deletions
  1. 6 3
      apps/mount.c

+ 6 - 3
apps/mount.c

@@ -9,6 +9,7 @@
  */
 
 #include <stdio.h>
+#include <errno.h>
 
 #ifndef mount
 extern int mount(char * source, char * target, char * type, unsigned long flags, void * data);
@@ -20,9 +21,11 @@ int main(int argc, char ** argv) {
 		return 1;
 	}
 
-	if (mount(argv[2], argv[3], argv[1], 0, NULL) < 0) {
-//		perror("mount");
-		return 1;
+	int ret = mount(argv[2], argv[3], argv[1], 0, NULL);
+
+	if (ret < 0) {
+		fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
+		return ret;
 	}
 
 	return 0;