X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;ds=sidebyside;f=kmodloader.c;h=f80835a7f942ba80a71fb6f44b263055fbf2de8b;hb=8488bb5bfdaf6ab4771622c57a62aad5fd491f06;hp=2dc795e8b18399bec325fd5fb5899b8b55d87d64;hpb=5a2d469ab30b73536c920a2a69c7fdf0d2c1a359;p=project%2Fubox.git diff --git a/kmodloader.c b/kmodloader.c index 2dc795e..f80835a 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -450,7 +450,7 @@ static int deps_available(struct module *m, int verbose) char *dep; int err = 0; - if (!strcmp(m->depends, "-") || !strcmp(m->depends, "")) + if (!m->depends || !strcmp(m->depends, "-") || !strcmp(m->depends, "")) return 0; dep = m->depends; @@ -609,7 +609,10 @@ static int main_insmod(int argc, char **argv) cur += sprintf(cur, "%s", argv[i]); } - init_module_folders(); + if (init_module_folders()) { + fprintf(stderr, "Failed to find the folder holding the modules\n"); + return -1; + } if (get_module_path(argv[1])) { name = argv[1]; @@ -658,15 +661,26 @@ static int main_rmmod(int argc, char **argv) static int main_lsmod(int argc, char **argv) { struct module *m; + char *dep; if (scan_loaded_modules()) return -1; avl_for_each_element(&modules, m, avl) - if (m->state == LOADED) - printf("%-20s%8d%3d %s\n", - m->name, m->size, m->usage, - (*m->depends == '-') ? ("") : (m->depends)); + if (m->state == LOADED) { + printf("%-20s%8d%3d ", + m->name, m->size, m->usage); + if (m->depends && strcmp(m->depends, "-") && strcmp(m->depends, "")) { + dep = m->depends; + while (*dep) { + printf("%s", dep); + dep = dep + strlen(dep) + 1; + if (*dep) + printf(","); + } + } + printf("\n"); + } free_modules(); @@ -761,11 +775,15 @@ static int main_loader(int argc, char **argv) strcpy(path, dir); strcat(path, "*"); - if (scan_loaded_modules()) + if (scan_loaded_modules()) { + free (path); return -1; + } - if (scan_module_folders()) + if (scan_module_folders()) { + free (path); return -1; + } syslog(LOG_INFO, "kmodloader: loading kernel modules from %s\n", path);