Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dracut-install): fix declaration hides variable #2229

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/install/dracut-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down