summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-02-11 18:13:37 +0000
committerOlivier Blin <oblin@mandriva.com>2008-02-11 18:13:37 +0000
commitff839f5434f243d93addb4ad36977acc69ae07eb (patch)
treea3660ca271981924ae97b2c6ac6dfa79dcab1590
parentbd17df2a745de61097f0c3c64072d11947cb86fb (diff)
downloaddrakx-ff839f5434f243d93addb4ad36977acc69ae07eb.tar
drakx-ff839f5434f243d93addb4ad36977acc69ae07eb.tar.gz
drakx-ff839f5434f243d93addb4ad36977acc69ae07eb.tar.bz2
drakx-ff839f5434f243d93addb4ad36977acc69ae07eb.tar.xz
drakx-ff839f5434f243d93addb4ad36977acc69ae07eb.zip
alloc the string in filename2modname
-rw-r--r--mdk-stage1/modules.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index b9cc3dd87..3b477f3c3 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -88,12 +88,19 @@ static char *kernel_module_extension(void)
}
-static void filename2modname(char * filename) {
- while (filename && *filename) {
- if (*filename == '-')
- *filename = '_';
- filename++;
+static char *filename2modname(char * filename) {
+ char *modname, *p;
+
+ modname = strdup(filename);
+
+ p = modname;
+ while (p && *p) {
+ if (*p == '-')
+ *p = '_';
+ p++;
}
+
+ return modname;
}
static void find_modules_directory(void)
@@ -135,8 +142,7 @@ static int load_modules_dependencies(void)
/* sort of a good line */
modules_deps[line].filename = strdup(start);
- modules_deps[line].modname = strdup(start);
- filename2modname(modules_deps[line].modname);
+ modules_deps[line].modname = filename2modname(start);
start = ptr;
i = 0;
@@ -195,8 +201,7 @@ static int load_modules_descriptions(void)
*ptr = '\0';
ptr++;
- modules_descr[line].modname = strdup(start);
- filename2modname(modules_deps[line].modname);
+ modules_descr[line].modname = filename2modname(start);
modules_descr[line].description = strndup(ptr, 50);
line++;