summaryrefslogtreecommitdiff
path: root/modutils/modprobe.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2004-08-11 02:30:30 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2004-08-11 02:30:30 +0000
commit65c8c7ba2775007fbd4f02272180900f665024f3 (patch)
treeed5e9b604b09f7046c19f55686cd80f5a695b1a2 /modutils/modprobe.c
parent2f325a030b9ebc34627f8d780c73bb17e7c0f5bd (diff)
downloadbusybox-w32-65c8c7ba2775007fbd4f02272180900f665024f3.tar.gz
busybox-w32-65c8c7ba2775007fbd4f02272180900f665024f3.tar.bz2
busybox-w32-65c8c7ba2775007fbd4f02272180900f665024f3.zip
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."
Diffstat (limited to 'modutils/modprobe.c')
-rw-r--r--modutils/modprobe.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index e1e451943..fd984e446 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -361,21 +361,20 @@ static struct dep_t *build_dep ( void )
361/* return 1 = found, 0 = not found */ 361/* return 1 = found, 0 = not found */
362static int mod_strcmp ( const char *mod_path, const char *mod_name ) 362static int mod_strcmp ( const char *mod_path, const char *mod_name )
363{ 363{
364#if defined(CONFIG_FEATURE_2_6_MODULES)
365#define MODULE_EXTENSION ".ko"
366#define MOD_EXTENSION_LEN 3
367#else
368#define MODULE_EXTENSION ".o"
369#define MOD_EXTENSION_LEN 2
370#endif
371 /* last path component */ 364 /* last path component */
372 const char *last_comp = strrchr (mod_path, '/'); 365 const char *last_comp = strrchr (mod_path, '/');
366 const char *mod_ext = ".o";
367
368#if defined(CONFIG_FEATURE_2_6_MODULES)
369 if ( k_version > 4 )
370 mod_ext = ".ko";
371#endif
373 372
374 return (strncmp(last_comp ? last_comp + 1 : mod_path, 373 return (strncmp(last_comp ? last_comp + 1 : mod_path,
375 mod_name, 374 mod_name,
376 strlen(mod_name)) == 0 ) && 375 strlen(mod_name)) == 0 ) &&
377 (strcmp(mod_path + strlen(mod_path) - 376 (strcmp(mod_path + strlen(mod_path) -
378 MOD_EXTENSION_LEN, MODULE_EXTENSION) == 0); 377 strlen(mod_ext), mod_ext) == 0);
379} 378}
380 379
381/* return 1 = loaded, 0 = not loaded, -1 = can't tell */ 380/* return 1 = loaded, 0 = not loaded, -1 = can't tell */