Skip to contentSkip to conversation

Bug#782692: kmod: spurious spaces in lsmod output

PATCH Applied Marco d'Itri 2 participants 2 messages Apr 16, 2015

lore
Share & tools
lore
#0 lore raw

----- Forwarded message from Santiago Vila <[email protected]> -----

From: Santiago Vila <[email protected]>
To: [email protected]
Subject: Bug#782692: kmod: spurious spaces in lsmod output

Package: kmod
Version: 18-3
Severity: minor

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 (untested but trivial) patch should fix it. It just delays the space to the point where we are sure that there are more things to print.

Thanks.

tools/lsmod.c +4 -2
index e953c7e..c1bab7f 100644
@@ -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)
 				putchar(',');
-			else
+			else {
+				putchar(' ');
 				first = 0;
+			}
 
 			fputs(kmod_module_get_name(hm), stdout);
 			kmod_module_unref(hm);

----- End forwarded message -----

Signature · 2 lines
ciao,
Marco
#1 lore raw
Quoted 10 lines · Marco d'Itri

----- Forwarded message from Santiago Vila <[email protected]> -----

From: Santiago Vila <[email protected]>
To: [email protected]
Subject: Bug#782692: kmod: spurious spaces in lsmod output

Package: kmod
Version: 18-3
Severity: minor

Quoted 5 lines

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 (untested but trivial) patch should fix it. It just delays the space to the point where we are sure that there are more things to print.

Applied, thanks.

Signature · 1 line
Lucas De Marchi