From: Santiago Vila Date: Thu, 16 Apr 2015 11:44:22 +0000 (-0300) Subject: Fix spurious spaces in lsmod output X-Git-Tag: v21~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7266ec43371fff8304e730b24729b2c6a95d75c4;p=thirdparty%2Fkmod.git Fix spurious spaces in lsmod output While using "localyesconfig" to build a custom kernel I noticed that lsmod output now has trailing spaces when the list of "Used by" modules is empty. The following patch just delays the space to the point where we are sure that there are more things to print. --- diff --git a/tools/lsmod.c b/tools/lsmod.c index e953c7e5..d9a27f2d 100644 --- a/tools/lsmod.c +++ b/tools/lsmod.c @@ -64,15 +64,17 @@ static int do_lsmod(int argc, char *argv[]) struct kmod_list *holders, *hitr; int first = 1; - printf("%-19s %8ld %d ", name, size, use_count); + printf("%-19s %8ld %d", name, size, use_count); holders = kmod_module_get_holders(mod); kmod_list_foreach(hitr, holders) { struct kmod_module *hm = kmod_module_get_module(hitr); - if (!first) + if (!first) { putchar(','); - else + } else { + putchar(' '); first = 0; + } fputs(kmod_module_get_name(hm), stdout); kmod_module_unref(hm);