mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-12-27 13:55:35 +07:00
Only search path in moddep if it's not already set
rmmod/insmod should be able to operate directly on files, not relying on indexes and configuration. The following test was not working and now it is: $ # go to a dir != mod->dirname $ cd /lib/modules/$(uname -r)/kernel $ # try to insert module giving a relative path $ insmod drivers/acpi/ac.ko
This commit is contained in:
parent
4eb2c0fca1
commit
e005facdb9
@ -419,19 +419,22 @@ KMOD_EXPORT const char *kmod_module_get_name(const struct kmod_module *mod)
|
||||
*/
|
||||
KMOD_EXPORT const char *kmod_module_get_path(const struct kmod_module *mod)
|
||||
{
|
||||
if (!mod->init.dep) {
|
||||
/* lazy init */
|
||||
char *line = kmod_search_moddep(mod->ctx, mod->name);
|
||||
char *line;
|
||||
|
||||
if (line == NULL)
|
||||
return NULL;
|
||||
DBG(mod->ctx, "name='%s' path='%s'", mod->name, mod->path);
|
||||
|
||||
kmod_module_parse_depline((struct kmod_module *) mod, line);
|
||||
free(line);
|
||||
if (mod->path != NULL)
|
||||
return mod->path;
|
||||
if (mod->init.dep)
|
||||
return NULL;
|
||||
|
||||
if (!mod->init.dep)
|
||||
return NULL;
|
||||
}
|
||||
/* lazy init */
|
||||
line = kmod_search_moddep(mod->ctx, mod->name);
|
||||
if (line == NULL)
|
||||
return NULL;
|
||||
|
||||
kmod_module_parse_depline((struct kmod_module *) mod, line);
|
||||
free(line);
|
||||
|
||||
return mod->path;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user