diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-01-15 02:48:36 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-01-15 02:49:59 +0100 |
commit | e998b08f118a0e485fffaa513bac133df2e3843b (patch) | |
tree | a35873cff0aff4057cd96d2dd5d9439c29296091 | |
parent | 1b6715345f2ad026482c336d2844c2d7fe64a25c (diff) | |
download | busybox-w32-e998b08f118a0e485fffaa513bac133df2e3843b.tar.gz busybox-w32-e998b08f118a0e485fffaa513bac133df2e3843b.tar.bz2 busybox-w32-e998b08f118a0e485fffaa513bac133df2e3843b.zip |
modprobe: fix recent breakage: modules.dep reading code needs to strip dirname
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | modutils/modprobe.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index f08f0850d..d1adaf8e1 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -15,8 +15,11 @@ | |||
15 | #include <sys/utsname.h> | 15 | #include <sys/utsname.h> |
16 | #include <fnmatch.h> | 16 | #include <fnmatch.h> |
17 | 17 | ||
18 | //#define DBG(fmt, ...) bb_error_msg("%s: " fmt, __func__, ## __VA_ARGS__) | 18 | #if 1 |
19 | #define DBG(...) ((void)0) | 19 | #define DBG(...) ((void)0) |
20 | #else | ||
21 | #define DBG(fmt, ...) bb_error_msg("%s: " fmt, __func__, ## __VA_ARGS__) | ||
22 | #endif | ||
20 | 23 | ||
21 | /* Note that unlike older versions of modules.dep/depmod (busybox and m-i-t), | 24 | /* Note that unlike older versions of modules.dep/depmod (busybox and m-i-t), |
22 | * we expect the full dependency list to be specified in modules.dep. | 25 | * we expect the full dependency list to be specified in modules.dep. |
@@ -204,7 +207,7 @@ static struct module_entry *helper_get_module(const char *module, int create) | |||
204 | unsigned i; | 207 | unsigned i; |
205 | unsigned hash; | 208 | unsigned hash; |
206 | 209 | ||
207 | filename2modname(module, modname); | 210 | filename2modname(bb_get_last_path_component_nostrip(module), modname); |
208 | 211 | ||
209 | hash = 0; | 212 | hash = 0; |
210 | for (i = 0; modname[i]; i++) | 213 | for (i = 0; modname[i]; i++) |
@@ -546,7 +549,6 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) | |||
546 | 549 | ||
547 | if (opt & OPT_LIST_ONLY) { | 550 | if (opt & OPT_LIST_ONLY) { |
548 | int i; | 551 | int i; |
549 | char name[MODULE_NAME_LEN]; | ||
550 | char *colon, *tokens[2]; | 552 | char *colon, *tokens[2]; |
551 | parser_t *p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, xfopen_for_read); | 553 | parser_t *p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, xfopen_for_read); |
552 | 554 | ||
@@ -558,10 +560,14 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) | |||
558 | if (!colon) | 560 | if (!colon) |
559 | continue; | 561 | continue; |
560 | *colon = '\0'; | 562 | *colon = '\0'; |
561 | filename2modname(tokens[0], name); | ||
562 | if (!argv[0]) | 563 | if (!argv[0]) |
563 | puts(tokens[0]); | 564 | puts(tokens[0]); |
564 | else { | 565 | else { |
566 | char name[MODULE_NAME_LEN]; | ||
567 | filename2modname( | ||
568 | bb_get_last_path_component_nostrip(tokens[0]), | ||
569 | name | ||
570 | ); | ||
565 | for (i = 0; argv[i]; i++) { | 571 | for (i = 0; argv[i]; i++) { |
566 | if (fnmatch(argv[i], name, 0) == 0) { | 572 | if (fnmatch(argv[i], name, 0) == 0) { |
567 | puts(tokens[0]); | 573 | puts(tokens[0]); |