diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2016-07-13 16:55:20 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-07-19 13:55:43 +0200 |
commit | aead2c0cbffdda9b46d74a998a4c6aeef423b21a (patch) | |
tree | 63da11dc49509fdd94441196db8ee8e0b1707a01 /kmodloader.c | |
parent | 81c38e8cc3913afcdf5c6916db0376000086b57f (diff) | |
download | ubox-aead2c0cbffdda9b46d74a998a4c6aeef423b21a.tar.gz |
kmodloader: fix lsmod depends output
Without this patch only the first dependency is shown, with this patch
all module dependencies are show.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'kmodloader.c')
-rw-r--r-- | kmodloader.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/kmodloader.c b/kmodloader.c index ad1f1c0..e32e6af 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -658,15 +658,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(); |