diff options
author | Ron Yorston <rmy@pobox.com> | 2015-03-14 20:33:00 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-03-14 20:33:00 +0000 |
commit | a4f58436b78fe59e57620c6e0301f213ee25f273 (patch) | |
tree | 8355f724926e605280af2d6f2b1ccc6b1bd02dee /modutils/modutils.c | |
parent | ba0c36cfcf84efbac6f89e27238e04bb57e9cd45 (diff) | |
parent | 49acc1a7618a28d34381cbb7661d7c981fcb238f (diff) | |
download | busybox-w32-a4f58436b78fe59e57620c6e0301f213ee25f273.tar.gz busybox-w32-a4f58436b78fe59e57620c6e0301f213ee25f273.tar.bz2 busybox-w32-a4f58436b78fe59e57620c6e0301f213ee25f273.zip |
Merge branch 'busybox' into merge
Conflicts:
coreutils/od_bloaty.c
libbb/lineedit.c
Diffstat (limited to 'modutils/modutils.c')
-rw-r--r-- | modutils/modutils.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modutils/modutils.c b/modutils/modutils.c index 6187ca72f..84300d931 100644 --- a/modutils/modutils.c +++ b/modutils/modutils.c | |||
@@ -47,18 +47,26 @@ int FAST_FUNC string_to_llist(char *string, llist_t **llist, const char *delim) | |||
47 | 47 | ||
48 | char* FAST_FUNC filename2modname(const char *filename, char *modname) | 48 | char* FAST_FUNC filename2modname(const char *filename, char *modname) |
49 | { | 49 | { |
50 | char local_modname[MODULE_NAME_LEN]; | ||
50 | int i; | 51 | int i; |
51 | char *from; | 52 | const char *from; |
52 | 53 | ||
53 | if (filename == NULL) | 54 | if (filename == NULL) |
54 | return NULL; | 55 | return NULL; |
55 | if (modname == NULL) | 56 | if (modname == NULL) |
56 | modname = xmalloc(MODULE_NAME_LEN); | 57 | modname = local_modname; |
57 | from = bb_get_last_path_component_nostrip(filename); | 58 | // Disabled since otherwise "modprobe dir/name" would work |
59 | // as if it is "modprobe name". It is unclear why | ||
60 | // 'basenamization' was here in the first place. | ||
61 | //from = bb_get_last_path_component_nostrip(filename); | ||
62 | from = filename; | ||
58 | for (i = 0; i < (MODULE_NAME_LEN-1) && from[i] != '\0' && from[i] != '.'; i++) | 63 | for (i = 0; i < (MODULE_NAME_LEN-1) && from[i] != '\0' && from[i] != '.'; i++) |
59 | modname[i] = (from[i] == '-') ? '_' : from[i]; | 64 | modname[i] = (from[i] == '-') ? '_' : from[i]; |
60 | modname[i] = '\0'; | 65 | modname[i] = '\0'; |
61 | 66 | ||
67 | if (modname == local_modname) | ||
68 | return xstrdup(modname); | ||
69 | |||
62 | return modname; | 70 | return modname; |
63 | } | 71 | } |
64 | 72 | ||