modprobe: fix "modprobe -l name-with-dash"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-02-15 02:17:31 +01:00
parent df7f2008c2
commit 5dad4aeede

View File

@ -530,10 +530,14 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
xchdir(G.uts.release); xchdir(G.uts.release);
if (opt & OPT_LIST_ONLY) { if (opt & OPT_LIST_ONLY) {
int i;
char name[MODULE_NAME_LEN]; char name[MODULE_NAME_LEN];
char *colon, *tokens[2]; char *colon, *tokens[2];
parser_t *p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, xfopen_for_read); parser_t *p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, xfopen_for_read);
for (i = 0; argv[i]; i++)
replace(argv[i], '-', '_');
while (config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)) { while (config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)) {
colon = last_char_is(tokens[0], ':'); colon = last_char_is(tokens[0], ':');
if (!colon) if (!colon)
@ -543,7 +547,6 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
if (!argv[0]) if (!argv[0])
puts(tokens[0]); puts(tokens[0]);
else { else {
int i;
for (i = 0; argv[i]; i++) { for (i = 0; argv[i]; i++) {
if (fnmatch(argv[i], name, 0) == 0) { if (fnmatch(argv[i], name, 0) == 0) {
puts(tokens[0]); puts(tokens[0]);