[git commit] fbset: abort on unknown options. closes 3121

Denys Vlasenko vda.linux at googlemail.com
Mon May 9 01:57:27 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=12bc152b31420c3e3d441c87a995fe7b65dd23fe
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 util-linux/fbset.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 75d41b8..3be3424 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -402,7 +402,14 @@ int fbset_main(int argc, char **argv)
 	argv++;
 	argc--;
 	for (; argc > 0 && (thisarg = *argv) != NULL; argc--, argv++) {
-		if (thisarg[0] == '-') for (i = 0; i < ARRAY_SIZE(g_cmdoptions); i++) {
+		if (thisarg[0] != '-') {
+			if (!ENABLE_FEATURE_FBSET_READMODE || argc != 1)
+				bb_show_usage();
+			mode = thisarg;
+			options |= OPT_READMODE;
+			goto contin;
+		}
+		for (i = 0; i < ARRAY_SIZE(g_cmdoptions); i++) {
 			if (strcmp(thisarg + 1, g_cmdoptions[i].name) != 0)
 				continue;
 			if (argc <= g_cmdoptions[i].param_count)
@@ -471,10 +478,7 @@ int fbset_main(int argc, char **argv)
 			argv += g_cmdoptions[i].param_count;
 			goto contin;
 		}
-		if (!ENABLE_FEATURE_FBSET_READMODE || argc != 1)
-			bb_show_usage();
-		mode = *argv;
-		options |= OPT_READMODE;
+		bb_show_usage();
  contin: ;
 	}
 
-- 
1.7.3.4



More information about the busybox-cvs mailing list