diff options
author | Santiago Vila <sanvila@unex.es> | 2015-04-16 08:44:22 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-04-16 08:46:43 -0300 |
commit | 7266ec43371fff8304e730b24729b2c6a95d75c4 (patch) | |
tree | 51096a7a0baa6b7b517aa5444c64f49a3315ab8c | |
parent | a8c73b86091f9ab3a39d80f80e4258e4c039a27d (diff) | |
download | kmod-7266ec43371fff8304e730b24729b2c6a95d75c4.tar.gz |
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.
-rw-r--r-- | tools/lsmod.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/lsmod.c b/tools/lsmod.c index e953c7e..d9a27f2 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); |