[BusyBox] [PATCH] umount: add support for multiple device/directory args

Chris Larson kergoth at handhelds.org
Wed Feb 4 19:53:37 UTC 2004


* Chris Larson (kergoth at handhelds.org) wrote:
> Just noticed that umount could only unmount one thing at a time, but
> util-linux's could handle multiple.  Simple patch attached.

Forgot to include updated usage info.  Regenerated patch attached.

--
Chris Larson - kergoth at handhelds dot org
Embedded Linux Developer - clarson at ti dot com
OpenZaurus Project Maintainer - http://openzaurus.org/
-------------- next part --------------

#
# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
#

--- busybox-1.00-pre3/util-linux/umount.c~umount-multargs
+++ busybox-1.00-pre3/util-linux/umount.c
@@ -238,7 +238,7 @@
 
 extern int umount_main(int argc, char **argv)
 {
-	char path[PATH_MAX];
+	char path[PATH_MAX], result = 0;
 
 	if (argc < 2) {
 		bb_show_usage();
@@ -286,10 +286,13 @@
 		else
 			return EXIT_FAILURE;
 	}
-	if (realpath(*argv, path) == NULL)
-		bb_perror_msg_and_die("%s", path);
-	if (do_umount(path))
-		return EXIT_SUCCESS;
-	bb_perror_msg_and_die("%s", *argv);
-}
 
+	do {
+		if (realpath(*argv, path) != NULL)
+			if (do_umount(path))
+				continue;
+		bb_perror_msg("%s", path);
+		result++;
+	} while (--argc > 0 && ++argv);
+	return result;
+}
--- busybox-1.00-pre3/docs/busybox.sgml~umount-multargs
+++ busybox-1.00-pre3/docs/busybox.sgml
@@ -3441,7 +3441,7 @@
 	    <title>umount</title>
 
 		<para>
-		Usage: umount [OPTION]... DEVICE|DIRECTORY
+		Usage: umount [OPTION]... DEVICE|DIRECTORY [...]
 		</para>
 
 		<para>
--- busybox-1.00-pre3/include/usage.h~umount-multargs
+++ busybox-1.00-pre3/include/usage.h
@@ -2600,7 +2600,7 @@
   #define USAGE_MOUNT_FORCE(a)
 #endif
 #define umount_trivial_usage \
-	"[flags] FILESYSTEM|DIRECTORY"
+	"[flags] FILESYSTEM|DIRECTORY [...]"
 #define umount_full_usage \
 	"Unmount file systems\n" \
 	"\nFlags:\n" "\t-a\tUnmount all file systems" \


More information about the busybox mailing list