[BusyBox-cvs] CVS update of busybox/modutils (modprobe.c)

Glenn McGrath bug1 at codepoet.org
Wed Aug 11 02:30:31 UTC 2004


    Date: Tuesday, August 10, 2004 @ 20:30:30
  Author: bug1
    Path: /var/cvs/busybox/modutils

Modified: modprobe.c (1.34 -> 1.35)

Willian Barsse wrote
"There seems to be a slight problem with the "mod_strcmp" function in
modprobe.c, it scans for the first occurence of the module name in the
"mod_path" variable and expects it to be the last path element. ie
/lib/modules/2.4.22-debug/kernel/fs/vfat in my example. The comparison
will always fail if mod_path contains another substring matching the
module name."

Robert McQueen wrote
"Although William Barsse's patch fixed mod_strcmp for 2.4 kernels, there
was a remaining problem which prevented it from working for me. I've
just tracked it down - when you enable kernel 2.6 module support it
hard-wired the extension to .ko instead of checking at runtime like the
other places where 2.4 differs from 2.6. The attached patch fixes this
for me."


Index: busybox/modutils/modprobe.c
diff -u busybox/modutils/modprobe.c:1.34 busybox/modutils/modprobe.c:1.35
--- busybox/modutils/modprobe.c:1.34	Tue Aug  3 02:23:33 2004
+++ busybox/modutils/modprobe.c	Tue Aug 10 20:30:30 2004
@@ -361,21 +361,20 @@
 /* return 1 = found, 0 = not found                        */
 static int mod_strcmp ( const char *mod_path, const char *mod_name )
 {
-#if defined(CONFIG_FEATURE_2_6_MODULES)
-#define MODULE_EXTENSION	".ko"
-#define MOD_EXTENSION_LEN	3
-#else
-#define MODULE_EXTENSION	".o"
-#define MOD_EXTENSION_LEN	2
-#endif
 	/* last path component */
 	const char *last_comp = strrchr (mod_path, '/'); 
+	const char *mod_ext = ".o";
+
+#if defined(CONFIG_FEATURE_2_6_MODULES)
+	if ( k_version > 4 )
+		mod_ext = ".ko";
+#endif
 
 	return (strncmp(last_comp ? last_comp + 1 : mod_path,
 					 mod_name,
 					 strlen(mod_name)) == 0 ) &&
 		   (strcmp(mod_path + strlen(mod_path) -
-					MOD_EXTENSION_LEN, MODULE_EXTENSION) == 0);
+					strlen(mod_ext), mod_ext) == 0);
 }
 
 /* return 1 = loaded, 0 = not loaded, -1 = can't tell */



More information about the busybox-cvs mailing list