All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmsetup: treat no devices found as error
@ 2016-02-17  7:51 Hannes Reinecke
  2016-02-17 10:08 ` Zdenek Kabelac
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2016-02-17  7:51 UTC (permalink / raw)
  To: lvm-devel

When calling 'dmsetup ls' and no devices are found the program will
print out 'No devices found' and exit normally.
This makes it really hard for the calling application to determine
if the output 'No devices found' is a valid device or not.
This patch moves the 'No devices found' string to stderr and
sets the return code to non-0 to allow calling applications to
better differentiate here.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 tools/dmsetup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 4db6004..3629931 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -1835,7 +1835,8 @@ static int _process_all(const struct command *cmd, const char *subcommand, int a
 
 	if (!names->dev) {
 		if (!silent)
-			printf("No devices found\n");
+			fprintf(stderr, "No devices found\n");
+		r = 0;
 		goto out;
 	}
 
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-17 10:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17  7:51 [PATCH] dmsetup: treat no devices found as error Hannes Reinecke
2016-02-17 10:08 ` Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.