diff options
Diffstat (limited to 'modutils/modprobe-small.c')
-rw-r--r-- | modutils/modprobe-small.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index b7990bff1..cf8a3f0fe 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c | |||
@@ -149,9 +149,13 @@ static void replace(char *s, char what, char with) | |||
149 | static char *filename2modname(const char *filename, char *modname) | 149 | static char *filename2modname(const char *filename, char *modname) |
150 | { | 150 | { |
151 | int i; | 151 | int i; |
152 | char *from; | 152 | const char *from; |
153 | 153 | ||
154 | from = bb_get_last_path_component_nostrip(filename); | 154 | // Disabled since otherwise "modprobe dir/name" would work |
155 | // as if it is "modprobe name". It is unclear why | ||
156 | // 'basenamization' was here in the first place. | ||
157 | //from = bb_get_last_path_component_nostrip(filename); | ||
158 | from = filename; | ||
155 | for (i = 0; i < (MODULE_NAME_LEN-1) && from[i] != '\0' && from[i] != '.'; i++) | 159 | for (i = 0; i < (MODULE_NAME_LEN-1) && from[i] != '\0' && from[i] != '.'; i++) |
156 | modname[i] = (from[i] == '-') ? '_' : from[i]; | 160 | modname[i] = (from[i] == '-') ? '_' : from[i]; |
157 | modname[i] = '\0'; | 161 | modname[i] = '\0'; |
@@ -631,6 +635,14 @@ static void process_module(char *name, const char *cmdline_options) | |||
631 | infovec = find_alias(name); | 635 | infovec = find_alias(name); |
632 | } | 636 | } |
633 | 637 | ||
638 | if (!infovec) { | ||
639 | /* both dirscan and find_alias found nothing */ | ||
640 | if (!is_rmmod && applet_name[0] != 'd') /* it wasn't rmmod or depmod */ | ||
641 | bb_error_msg("module '%s' not found", name); | ||
642 | //TODO: _and_die()? or should we continue (un)loading modules listed on cmdline? | ||
643 | goto ret; | ||
644 | } | ||
645 | |||
634 | /* There can be more than one module for the given alias. For example, | 646 | /* There can be more than one module for the given alias. For example, |
635 | * "pci:v00008086d00007010sv00000000sd00000000bc01sc01i80" matches | 647 | * "pci:v00008086d00007010sv00000000sd00000000bc01sc01i80" matches |
636 | * ata_piix because it has alias "pci:v00008086d00007010sv*sd*bc*sc*i*" | 648 | * ata_piix because it has alias "pci:v00008086d00007010sv*sd*bc*sc*i*" |
@@ -646,7 +658,8 @@ static void process_module(char *name, const char *cmdline_options) | |||
646 | int r; | 658 | int r; |
647 | char modname[MODULE_NAME_LEN]; | 659 | char modname[MODULE_NAME_LEN]; |
648 | 660 | ||
649 | filename2modname(info->pathname, modname); | 661 | filename2modname( |
662 | bb_get_last_path_component_nostrip(info->pathname), modname); | ||
650 | r = delete_module(modname, O_NONBLOCK | O_EXCL); | 663 | r = delete_module(modname, O_NONBLOCK | O_EXCL); |
651 | dbg1_error_msg("delete_module('%s', O_NONBLOCK | O_EXCL):%d", modname, r); | 664 | dbg1_error_msg("delete_module('%s', O_NONBLOCK | O_EXCL):%d", modname, r); |
652 | if (r != 0) { | 665 | if (r != 0) { |
@@ -669,14 +682,6 @@ static void process_module(char *name, const char *cmdline_options) | |||
669 | */ | 682 | */ |
670 | } | 683 | } |
671 | 684 | ||
672 | if (!infovec) { | ||
673 | /* both dirscan and find_alias found nothing */ | ||
674 | if (!is_rmmod && applet_name[0] != 'd') /* it wasn't rmmod or depmod */ | ||
675 | bb_error_msg("module '%s' not found", name); | ||
676 | //TODO: _and_die()? or should we continue (un)loading modules listed on cmdline? | ||
677 | goto ret; | ||
678 | } | ||
679 | |||
680 | infoidx = 0; | 685 | infoidx = 0; |
681 | while ((info = infovec[infoidx++]) != NULL) { | 686 | while ((info = infovec[infoidx++]) != NULL) { |
682 | /* Iterate thru dependencies, trying to (un)load them */ | 687 | /* Iterate thru dependencies, trying to (un)load them */ |