summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-02-11 18:28:56 +0000
committerOlivier Blin <oblin@mandriva.com>2008-02-11 18:28:56 +0000
commitf6847d6d944c546d5a1c9fcfb0fe17180a3b7073 (patch)
treee1ced790cf9ec6ce10e3a1a46d2a9346f76587e7 /mdk-stage1
parent31b31a216cc1ef378840c37682d3e8107e8e8072 (diff)
downloaddrakx-f6847d6d944c546d5a1c9fcfb0fe17180a3b7073.tar
drakx-f6847d6d944c546d5a1c9fcfb0fe17180a3b7073.tar.gz
drakx-f6847d6d944c546d5a1c9fcfb0fe17180a3b7073.tar.bz2
drakx-f6847d6d944c546d5a1c9fcfb0fe17180a3b7073.tar.xz
drakx-f6847d6d944c546d5a1c9fcfb0fe17180a3b7073.zip
strip directory and module extension when getting module name
Diffstat (limited to 'mdk-stage1')
-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) {