Skip to contentSkip to conversation

Fix dmsetup table output (different format in 2.02.85)

PATCH New Milan Broz 1 participant 1 message Jun 8, 2011

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 Fix dmsetup table output (different format in 2.02.85)

In previous versions < 2.02.85 dmsetup table <dev> produced just dmsetup table, no device.

# dmsetup table abc
0 100 zero

Now is the output changed to:

# dmsetup table abc
abc: 0 100 zero

It should be only for all and multiple devices, not for one.

It breaks at least cryptsetup test suite, I guess there are more problems.

Patch somehow workarounds it, I have no idea what was the intention for this change.
I guess even Alasdair should use patch review process sometimes :-p

---
 tools/dmsetup.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
tools/dmsetup.c +5 -2
index 2a8e5a6..a2a4b30 100644
@@ -1590,7 +1590,7 @@ static int _status(CMD_ARGS)
 			   _switches[VERBOSE_ARG]) {
 			if (!matched && _switches[VERBOSE_ARG])
 				_display_info(dmt);
-			if (multiple_devices && !_switches[VERBOSE_ARG])
+			if (multiple_devices > 1 && !_switches[VERBOSE_ARG])
 				printf("%s: ", name);
 			if (target_type) {
 				/* Suppress encryption key */
@@ -3412,7 +3412,10 @@ int main(int argc, char **argv)
 	#endif
 
       doit:
-	multiple_devices = (argc > 1);
+	if (argc > 1)
+		multiple_devices = (argc > 2) ? 2 : 1;
+	else
+		multiple_devices = 0;
 	do {
 		if (!cmd->fn(cmd, argc--, argv++, NULL, multiple_devices)) {
 			fprintf(stderr, "Command failed\n");
Signature · 1 line
1.7.5.3