summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/modules.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index b04c3038b..cc916a162 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -25,6 +25,7 @@
#include <sys/stat.h>
#include <sys/mount.h>
#include <fcntl.h>
+#include <libgen.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
@@ -91,7 +92,10 @@ static char *kernel_module_extension(void)
static char *filename2modname(char * filename) {
char *modname, *p;
- modname = strdup(filename);
+ modname = strdup(basename(filename));
+ if (strstr(modname, kernel_module_extension())) {
+ modname[strlen(modname)-strlen(kernel_module_extension())] = '\0'; /* remove trailing .ko.gz */
+ }
p = modname;
while (p && *p) {