From: Harald Hoyer Date: Thu, 10 Aug 2017 07:19:51 +0000 (+0200) Subject: dracut-install: fixed hostonly modules hashmap_put X-Git-Tag: 046~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F232%2Fhead;p=thirdparty%2Fdracut.git dracut-install: fixed hostonly modules hashmap_put --- diff --git a/install/dracut-install.c b/install/dracut-install.c index cf56667c4..2c20b4915 100644 --- a/install/dracut-install.c +++ b/install/dracut-install.c @@ -1238,16 +1238,6 @@ static bool check_module_path(const char *path) return true; } -static bool check_module_hostonly(struct kmod_module *mod) -{ - const char *name = kmod_module_get_name(mod); - - if (check_hashmap(modules_loaded, name)) - return true; - - return false; -} - static int install_module(struct kmod_module *mod) { int ret = 0; @@ -1262,7 +1252,7 @@ static int install_module(struct kmod_module *mod) return 0; } - if (arg_hostonly && ! check_module_hostonly(mod)) { + if (arg_hostonly && !check_hashmap(modules_loaded, name)) { log_debug("dracut_install '%s' not hostonly", name); return 0; } @@ -1425,6 +1415,7 @@ static int install_modules(int argc, char **argv) while (!feof(f)) { size_t len; + char *dupname = NULL; if(!(fgets(name, sizeof(name), f))) continue; @@ -1436,7 +1427,9 @@ static int install_modules(int argc, char **argv) if (name[len-1] == '\n') name[len-1] = 0; - hashmap_put(modules_loaded, name, strdup(name)); + log_debug("Adding module '%s' to hostonly module list", name); + dupname = strdup(name); + hashmap_put(modules_loaded, dupname, dupname); } } }