X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubox.git;a=blobdiff_plain;f=kmodloader.c;h=5ba75c1aa36d24282991708c8bca019b5faa03ac;hp=2dc795e8b18399bec325fd5fb5899b8b55d87d64;hb=5649c028c426060616e2bd4e7ea83271cd333d21;hpb=5a2d469ab30b73536c920a2a69c7fdf0d2c1a359 diff --git a/kmodloader.c b/kmodloader.c index 2dc795e..5ba75c1 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, "falied 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();