diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-02-11 18:13:37 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-02-11 18:13:37 +0000 |
commit | ff839f5434f243d93addb4ad36977acc69ae07eb (patch) | |
tree | a3660ca271981924ae97b2c6ac6dfa79dcab1590 /mdk-stage1 | |
parent | bd17df2a745de61097f0c3c64072d11947cb86fb (diff) | |
download | drakx-backup-do-not-use-ff839f5434f243d93addb4ad36977acc69ae07eb.tar drakx-backup-do-not-use-ff839f5434f243d93addb4ad36977acc69ae07eb.tar.gz drakx-backup-do-not-use-ff839f5434f243d93addb4ad36977acc69ae07eb.tar.bz2 drakx-backup-do-not-use-ff839f5434f243d93addb4ad36977acc69ae07eb.tar.xz drakx-backup-do-not-use-ff839f5434f243d93addb4ad36977acc69ae07eb.zip |
alloc the string in filename2modname
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/modules.c | 23 |
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++; |