diff options
Diffstat (limited to 'command-list.c')
-rw-r--r-- | command-list.c | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/command-list.c b/command-list.c index c9ff683..fada288 100644 --- a/command-list.c +++ b/command-list.c @@ -43,6 +43,7 @@ #include "files.h" #include "kernel.h" #include "manifest.h" +#include "conflicting-kernel-modules.h" static void free_file_list(FileList* l); @@ -59,9 +60,7 @@ static void find_conflicting_opengl_libraries(Options *, const char *, FileList *); -static void find_conflicting_kernel_modules(Options *op, - Package *p, - FileList *l); +static void find_conflicting_kernel_modules(Options *op, FileList *l); static void find_existing_files(Package *p, FileList *l, PackageEntryFileTypeList *file_type_list); @@ -115,8 +114,9 @@ CommandList *build_command_list(Options *op, Package *p) /* find any possibly conflicting modules and/or libraries */ - if (!op->no_kernel_module || op->dkms) - find_conflicting_kernel_modules(op, p, l); + if (!op->no_kernel_module || op->dkms) { + find_conflicting_kernel_modules(op, l); + } /* check the conflicting file list for any installed kernel modules */ @@ -770,13 +770,13 @@ static void find_conflicting_opengl_libraries(Options *op, * modules under the kernel module installation prefix. */ -static void find_conflicting_kernel_modules(Options *op, - Package *p, FileList *l) +static void find_conflicting_kernel_modules(Options *op, FileList *l) { - int i = 0, n = 0; - ConflictingFileInfo files[2]; + int i = 0; + ConflictingFileInfo *files; char *paths[3]; char *tmp = get_kernel_name(op); + char **filenames; /* Don't descend into the "build" or "source" directories; these won't * contain modules, and may be symlinks back to an actual source tree. */ @@ -786,9 +786,6 @@ static void find_conflicting_kernel_modules(Options *op, { 0, NULL } }; - memset(files, 0, sizeof(files)); - files[1].name = NULL; - files[1].len = 0; if (op->kernel_module_installation_path) { paths[i++] = op->kernel_module_installation_path; } @@ -798,18 +795,25 @@ static void find_conflicting_kernel_modules(Options *op, } paths[i] = NULL; - + + /* Build the list of conflicting kernel modules */ + + files = nvalloc((num_conflicting_kernel_modules + 1) * sizeof(files[0])); + filenames = nvalloc(num_conflicting_kernel_modules * sizeof(filenames[0])); + + for (i = 0; i < num_conflicting_kernel_modules; i++) { + filenames[i] = nvstrcat(conflicting_kernel_modules[i], ".ko", NULL); + files[i].name = filenames[i]; + files[i].len = strlen(filenames[i]); + } + for (i = 0; paths[i]; i++) { - for (n = 0; p->bad_module_filenames[n]; n++) { - /* - * Recursively search for this conflicting kernel module - * relative to the current prefix. - */ - files[0].name = p->bad_module_filenames[n]; - files[0].len = strlen(files[0].name); + /* + * Recursively search for the conflicting kernel modules + * relative to the current prefix. + */ - find_conflicting_files(op, paths[i], files, l, skipdirs); - } + find_conflicting_files(op, paths[i], files, l, skipdirs); } /* free any paths we nvstrcat()'d above */ @@ -818,7 +822,14 @@ static void find_conflicting_kernel_modules(Options *op, nvfree(paths[i]); } -} /* find_conflicting_kernel_modules() */ + /* free the kernel module names */ + + for (i = 0; i < num_conflicting_kernel_modules; i++) { + nvfree(filenames[i]); + } + nvfree(filenames); + nvfree(files); +} |