summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2015-01-07 14:39:01 +0100
committerDenys Vlasenko2015-01-07 14:39:01 +0100
commit08364dab752e752ba3b7da30f64d09b72d9da0ad (patch)
treeccdaaa67d3d5c9ba7fec77510b471b38e4038995
parente5cae08f1232e66daca8f47f0f257a83a0cca9fa (diff)
downloadbusybox-08364dab752e752ba3b7da30f64d09b72d9da0ad.zip
busybox-08364dab752e752ba3b7da30f64d09b72d9da0ad.tar.gz
depmod: fix recent breakage in modules.dep generation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--modutils/depmod.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/modutils/depmod.c b/modutils/depmod.c
index aa228ec..a41b3e4 100644
--- a/modutils/depmod.c
+++ b/modutils/depmod.c
@@ -51,7 +51,11 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA
info->dnext = info->dprev = info;
info->name = xstrdup(fname + 2); /* skip "./" */
- info->modname = xstrdup(filename2modname(fname, modname));
+ info->modname = xstrdup(
+ filename2modname(
+ bb_get_last_path_component_nostrip(fname),
+ modname
+ ));
for (ptr = image; ptr < image + len - 10; ptr++) {
if (strncmp(ptr, "depends=", 8) == 0) {
char *u;
@@ -242,17 +246,18 @@ int depmod_main(int argc UNUSED_PARAM, char **argv)
if (!(option_mask32 & OPT_n))
xfreopen_write("modules.alias", stdout);
for (m = modules; m != NULL; m = m->next) {
+ char modname[MODULE_NAME_LEN];
const char *fname = bb_basename(m->name);
- int fnlen = strchrnul(fname, '.') - fname;
+ filename2modname(fname, modname);
while (m->aliases) {
/* Last word can well be m->modname instead,
* but depmod from module-init-tools 3.4
* uses module basename, i.e., no s/-/_/g.
* (pathname and .ko.* are still stripped)
* Mimicking that... */
- printf("alias %s %.*s\n",
+ printf("alias %s %s\n",
(char*)llist_pop(&m->aliases),
- fnlen, fname);
+ modname);
}
}
#endif
@@ -260,12 +265,13 @@ int depmod_main(int argc UNUSED_PARAM, char **argv)
if (!(option_mask32 & OPT_n))
xfreopen_write("modules.symbols", stdout);
for (m = modules; m != NULL; m = m->next) {
+ char modname[MODULE_NAME_LEN];
const char *fname = bb_basename(m->name);
- int fnlen = strchrnul(fname, '.') - fname;
+ filename2modname(fname, modname);
while (m->symbols) {
- printf("alias symbol:%s %.*s\n",
+ printf("alias symbol:%s %s\n",
(char*)llist_pop(&m->symbols),
- fnlen, fname);
+ modname);
}
}
#endif