diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-11-04 12:10:24 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-11-04 12:10:24 +0000 |
commit | f937ddc901c78571016f054ebc456e9716fbde73 (patch) | |
tree | bb96b8768398fbb2742ba5207d0aec4242d892aa /mdk-stage1 | |
parent | ef052622fc841e966bb8953b92f6397aae0cffd2 (diff) | |
download | drakx-backup-do-not-use-f937ddc901c78571016f054ebc456e9716fbde73.tar drakx-backup-do-not-use-f937ddc901c78571016f054ebc456e9716fbde73.tar.gz drakx-backup-do-not-use-f937ddc901c78571016f054ebc456e9716fbde73.tar.bz2 drakx-backup-do-not-use-f937ddc901c78571016f054ebc456e9716fbde73.tar.xz drakx-backup-do-not-use-f937ddc901c78571016f054ebc456e9716fbde73.zip |
cleanup code using kernel_module_extension()
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/modules.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index 27edb0349..a0876416e 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -164,6 +164,11 @@ int insmod_local_file(char * path, char * options) } } +static char *kernel_module_extension(void) +{ + return kernel_version() <= 4 ? ".o" : ".ko"; +} + /* unarchive and insmod given module * WARNING: module must not contain the trailing ".o" */ @@ -174,10 +179,7 @@ static enum insmod_return insmod_archived_file(const char * mod_name, char * opt int i, rc; strncpy(module_name, mod_name, sizeof(module_name)); - if (kernel_version() <= 4) - strcat(module_name, ".o"); - else - strcat(module_name, ".ko"); + strcat(module_name, kernel_module_extension()); i = mar_extract_file(archive_name, module_name, "/tmp/"); if (i == 1) { static int recurse = 0; @@ -526,10 +528,7 @@ enum return_type ask_insmod(enum driver_type type) } if (results == RETURN_OK) { - if (kernel_version() <= 4) - choice[strlen(choice)-2] = '\0'; /* remove trailing .o */ - else - choice[strlen(choice)-3] = '\0'; /* remove trailing .ko */ + choice[strlen(choice)-strlen(kernel_module_extension())] = '\0'; /* remove trailing .ko or .o */ return insmod_with_options(choice, type); } else return results; |