[PATCH 17/19] insmod: implement -q flag

Florian Fainelli florian at alphacore.org
Tue Sep 25 12:06:16 UTC 2012


From: Jo-Philipp Wich <jow at openwrt.org>

And suppress errors when this flag is set.

Signed-off-by: Jo-Philipp Wich <jow at openwrt.org>
---
 modutils/insmod.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/modutils/insmod.c b/modutils/insmod.c
index 887d9f2..22bac1f 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -39,7 +39,7 @@ int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int insmod_main(int argc UNUSED_PARAM, char **argv)
 {
 	char *filename;
-	int rc;
+	int rc, opt;
 
 	/* Compat note:
 	 * 2.6 style insmod has no options and required filename
@@ -49,17 +49,15 @@ int insmod_main(int argc UNUSED_PARAM, char **argv)
 	 * or in $MODPATH.
 	 */
 
-	IF_FEATURE_2_4_MODULES(
-		getopt32(argv, INSMOD_OPTS INSMOD_ARGS);
-		argv += optind - 1;
-	);
+	opt = getopt32(argv, INSMOD_OPTS, NULL, NULL);
+	argv += optind - 1;
 
 	filename = *++argv;
 	if (!filename)
 		bb_show_usage();
 
 	rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0));
-	if (rc)
+	if (rc && !(opt & INSMOD_OPT_SILENT))
 		bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
 
 	return rc;
-- 
1.7.9.5



More information about the busybox mailing list