diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c index 6bf5ce1fd7..fb85461a63 100644 --- a/src/install/dracut-install.c +++ b/src/install/dracut-install.c @@ -1177,12 +1177,12 @@ static int parse_argv(int argc, char *argv[]) uname(&buf); char fw_path_para[PATH_MAX + 1] = ""; - int path = open("/sys/module/firmware_class/parameters/path", O_RDONLY | O_CLOEXEC); - if (path != -1) { - ssize_t rd = read(path, fw_path_para, PATH_MAX); + int fd_path = open("/sys/module/firmware_class/parameters/path", O_RDONLY | O_CLOEXEC); + if (fd_path != -1) { + ssize_t rd = read(fd_path, fw_path_para, PATH_MAX); if (rd != -1) fw_path_para[rd - 1] = '\0'; - close(path); + close(fd_path); } char uk[22 + sizeof(buf.release)], fk[14 + sizeof(buf.release)]; sprintf(uk, "/lib/firmware/updates/%s", buf.release); @@ -1781,8 +1781,6 @@ static int modalias_list(struct kmod_ctx *ctx) _cleanup_fclose_ FILE *f = NULL; _cleanup_kmod_module_unref_list_ struct kmod_list *list = NULL; - int err; - char alias[2048] = {0}; size_t len; @@ -1839,7 +1837,7 @@ static int modalias_list(struct kmod_ctx *ctx) continue; kmod_list_foreach(l, modlist) { mod = kmod_module_get_module(l); - char *name = strdup(kmod_module_get_name(mod)); + name = strdup(kmod_module_get_name(mod)); hashmap_put(modules_loaded, name, name); kmod_module_unref(mod); } @@ -2127,13 +2125,13 @@ int main(int argc, char **argv) modules_loaded = hashmap_new(string_hash_func, string_compare_func); if (arg_modalias) { - Iterator i; + Iterator it; char *name; _cleanup_kmod_unref_ struct kmod_ctx *ctx = NULL; ctx = kmod_new(kerneldir, NULL); modalias_list(ctx); - HASHMAP_FOREACH(name, modules_loaded, i) { + HASHMAP_FOREACH(name, modules_loaded, it) { printf("%s\n", name); } exit(0);