diff options
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/modprobe.c | 21 | ||||
-rw-r--r-- | modutils/rmmod.c | 7 |
2 files changed, 7 insertions, 21 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index dbed4ea0f..3861dd1e3 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -376,18 +376,13 @@ static struct dep_t *build_dep(void) | |||
376 | 376 | ||
377 | if (col) { | 377 | if (col) { |
378 | /* This line is a dep description */ | 378 | /* This line is a dep description */ |
379 | char *mods; | 379 | const char *mods; |
380 | char *modpath; | 380 | char *modpath; |
381 | char *mod; | 381 | char *mod; |
382 | 382 | ||
383 | /* Find the beginning of the module file name */ | 383 | /* Find the beginning of the module file name */ |
384 | *col = 0; | 384 | *col = 0; |
385 | mods = strrchr(buffer, '/'); | 385 | mods = bb_basename(buffer); |
386 | |||
387 | if (!mods) | ||
388 | mods = buffer; /* no path for this module */ | ||
389 | else | ||
390 | mods++; /* there was a path for this module... */ | ||
391 | 386 | ||
392 | /* find the path of the module */ | 387 | /* find the path of the module */ |
393 | modpath = strchr(buffer, '/'); /* ... and this is the path */ | 388 | modpath = strchr(buffer, '/'); /* ... and this is the path */ |
@@ -433,7 +428,7 @@ static struct dep_t *build_dep(void) | |||
433 | /* p points to the first dependable module; if NULL, no dependable module */ | 428 | /* p points to the first dependable module; if NULL, no dependable module */ |
434 | if (p && *p) { | 429 | if (p && *p) { |
435 | char *end = &buffer[l-1]; | 430 | char *end = &buffer[l-1]; |
436 | char *deps; | 431 | const char *deps; |
437 | char *dep; | 432 | char *dep; |
438 | char *next; | 433 | char *next; |
439 | int ext = 0; | 434 | int ext = 0; |
@@ -451,15 +446,11 @@ static struct dep_t *build_dep(void) | |||
451 | next = end; | 446 | next = end; |
452 | 447 | ||
453 | /* find the beginning of the module file name */ | 448 | /* find the beginning of the module file name */ |
454 | deps = strrchr(p, '/'); | 449 | deps = bb_basename(p); |
455 | 450 | if (deps == p) { | |
456 | if (!deps || (deps < p)) { | ||
457 | deps = p; | ||
458 | |||
459 | while (isblank(*deps)) | 451 | while (isblank(*deps)) |
460 | deps++; | 452 | deps++; |
461 | } else | 453 | } |
462 | deps++; | ||
463 | 454 | ||
464 | /* find the end of the module name in the file name */ | 455 | /* find the end of the module name in the file name */ |
465 | if (ENABLE_FEATURE_2_6_MODULES | 456 | if (ENABLE_FEATURE_2_6_MODULES |
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index f78f96ccc..13f5ec20b 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
@@ -81,12 +81,7 @@ int rmmod_main(int argc, char **argv) | |||
81 | 81 | ||
82 | for (n = optind; n < argc; n++) { | 82 | for (n = optind; n < argc; n++) { |
83 | if (ENABLE_FEATURE_2_6_MODULES) { | 83 | if (ENABLE_FEATURE_2_6_MODULES) { |
84 | const char *afterslash; | 84 | filename2modname(misc_buf, bb_basename(argv[n])); |
85 | |||
86 | afterslash = strrchr(argv[n], '/'); | ||
87 | if (!afterslash) afterslash = argv[n]; | ||
88 | else afterslash++; | ||
89 | filename2modname(misc_buf, afterslash); | ||
90 | } | 85 | } |
91 | 86 | ||
92 | if (syscall(__NR_delete_module, ENABLE_FEATURE_2_6_MODULES ? misc_buf : argv[n], flags)) { | 87 | if (syscall(__NR_delete_module, ENABLE_FEATURE_2_6_MODULES ? misc_buf : argv[n], flags)) { |