modprobe: fix modprobe -r. closes bug 315

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2009-05-26 12:48:34 +02:00
parent 8d7be232a3
commit 140def848c

View File

@ -114,7 +114,9 @@ static void add_probe(const char *name)
struct module_entry *m; struct module_entry *m;
m = get_or_add_modentry(name); m = get_or_add_modentry(name);
if (m->flags & MODULE_FLAG_LOADED) { if (!(option_mask32 & MODPROBE_OPT_REMOVE)
&& (m->flags & MODULE_FLAG_LOADED)
) {
DBG("skipping %s, it is already loaded", name); DBG("skipping %s, it is already loaded", name);
return; return;
} }
@ -350,7 +352,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
config_close(parser); config_close(parser);
} }
if (opt & MODPROBE_OPT_INSERT_ALL) { if (opt & (MODPROBE_OPT_INSERT_ALL | MODPROBE_OPT_REMOVE)) {
/* Each argument is a module name */ /* Each argument is a module name */
do { do {
DBG("adding module %s", *argv); DBG("adding module %s", *argv);