insmod argument handling broken

Larry Doolittle ldoolitt at recycle.lbl.gov
Wed Jan 24 23:19:48 UTC 2001


Package: busybox
Version: 0.49pre
Severity: normal

The first half of this patch is required to restore the
previous (pre-getopt) behavior of insmod, with regard
to handling var=value style command line arguments.
$ insmod ne.o io=0x340
fails without this change (the "io=0x340" is ignored).

The second half is a minor cleanup, to use the create_module
API the way the documentation says it should be used.
I noticed the flaw, and put in the change.  My simple testing
shows it doesn't break anything.

    - Larry

--- /home/ldoolitt/cvs/busybox/insmod.c	Wed Jan 24 11:07:45 2001
+++ insmod.c	Wed Jan 24 14:51:21 2001
@@ -3043,6 +3043,9 @@
 	}
 	obj_allocate_commons(f);
 
+	/* done with the module name, on to the optional var=value arguments */
+	++optind;
+
 	if (optind < argc) {
 		if (m_has_modinfo
 			? !new_process_module_arguments(f, argc - optind, argv + optind) 
@@ -3062,11 +3065,8 @@
 	m_size = obj_load_size(f);
 
 
-	errno = 0;
 	m_addr = create_module(m_name, m_size);
-	switch (errno) {
-	case 0:
-		break;
+	if (m_addr==-1) switch (errno) {
 	case EEXIST:
 		error_msg("A module named %s already exists\n", m_name);
 		goto out;

---------------------------------------
Received: (at 1096-done) by bugs.lineo.com; 30 Jan 2001 18:24:36 +0000


More information about the busybox mailing list