diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-01-15 03:04:23 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-01-15 03:04:23 +0100 |
commit | 76b2262b9b911e1741b9b6d04ed15fcf076b8d2d (patch) | |
tree | 74fd93be96da031e0bf1172ebf646fd4e9a6dd3c /modutils | |
parent | e998b08f118a0e485fffaa513bac133df2e3843b (diff) | |
download | busybox-76b2262b9b911e1741b9b6d04ed15fcf076b8d2d.tar.gz |
modprobe: fix "modprobe devname:snd/timer" case (alias with a slash)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/modprobe.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index d1adaf8e1..ce8b0b886 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -207,7 +207,7 @@ static struct module_entry *helper_get_module(const char *module, int create) unsigned i; unsigned hash; - filename2modname(bb_get_last_path_component_nostrip(module), modname); + filename2modname(module, modname); hash = 0; for (i = 0; modname[i]; i++) @@ -232,9 +232,14 @@ static ALWAYS_INLINE struct module_entry *get_or_add_modentry(const char *module { return helper_get_module(module, 1); } -static ALWAYS_INLINE struct module_entry *get_modentry(const char *module) +/* So far this function always gets a module pathname, never an alias name. + * The crucial difference is that pathname needs dirname stripping, + * while alias name must NOT do it! + * Testcase where dirname stripping is likely to go wrong: "modprobe devname:snd/timer" + */ +static ALWAYS_INLINE struct module_entry *get_modentry(const char *pathname) { - return helper_get_module(module, 0); + return helper_get_module(bb_get_last_path_component_nostrip(pathname), 0); } static void add_probe(const char *name) @@ -502,7 +507,7 @@ static void load_modules_dep(void) colon = last_char_is(tokens[0], ':'); if (colon == NULL) continue; - *colon = 0; + *colon = '\0'; m = get_modentry(tokens[0]); if (m == NULL) |