From 2b909b9a4ba3e449bd94c5b5e9fb567f5206d918 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 10 Aug 2017 09:19:51 +0200 Subject: [PATCH] dracut-install: fixed hostonly modules hashmap_put --- install/dracut-install.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) 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); } } } -- 2.47.2