mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-12-21 14:11:17 +07:00
modprobe: post-remove module deps with 0 refcnt
This commit looks shockingly similar to0e9bd2d1
because SOMEONE decided to remove it ina872bba
in a glorious frenzy of refactoring.
This commit is contained in:
parent
2e9dcd742e
commit
69a1974347
@ -339,6 +339,7 @@ end:
|
||||
static int rmmod_do_remove_module(struct kmod_module *mod)
|
||||
{
|
||||
const char *modname = kmod_module_get_name(mod);
|
||||
struct kmod_list *deps, *itr;
|
||||
int flags = 0, err;
|
||||
|
||||
SHOW("rmmod %s\n", kmod_module_get_name(mod));
|
||||
@ -357,6 +358,17 @@ static int rmmod_do_remove_module(struct kmod_module *mod)
|
||||
LOG("Module %s is not in kernel.\n", modname);
|
||||
}
|
||||
|
||||
deps = kmod_module_get_dependencies(mod);
|
||||
if (deps != NULL) {
|
||||
kmod_list_foreach(itr, deps) {
|
||||
struct kmod_module *dep = kmod_module_get_module(itr);
|
||||
if (kmod_module_get_refcnt(dep) == 0)
|
||||
rmmod_do_remove_module(dep);
|
||||
kmod_module_unref(dep);
|
||||
}
|
||||
kmod_module_unref_list(deps);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user