summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2017-10-26 17:47:13 +0100
committerAlasdair G Kergon <agk@redhat.com>2017-10-26 17:47:13 +0100
commit4b0f6829f63d36b473f6670a41ac7521ff82674d (patch)
tree150142c8ba082d30f50da1a29a8de776b90cc43e
parentfdcc709ed0e5051f471ee64ac51f6c8e2ed941fc (diff)
downloadlvm2-4b0f6829f63d36b473f6670a41ac7521ff82674d.tar.gz
dmsetup: Add unknown device error to dmsetup status.
Treat status the same way as info if provided device name doesn't exist.
-rw-r--r--WHATS_NEW_DM1
-rw-r--r--tools/dmsetup.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index b0dd01bcd..6475fbdba 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.145 -
===================================
+ Issue a specific error with dmsetup status if device is unknown.
Fix RT_LIBS reference in generated libdevmapper.pc for pkg-config
Version 1.02.144 - 6th October 2017
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 661910f74..53097b38b 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -2431,9 +2431,14 @@ static int _status(CMD_ARGS)
if (!_task_run(dmt))
goto_out;
- if (!dm_task_get_info(dmt, &info) || !info.exists)
+ if (!dm_task_get_info(dmt, &info))
goto_out;
+ if (!info.exists) {
+ fprintf(stderr, "Device does not exist.\n");
+ goto_out;
+ }
+
if (!name)
name = dm_task_get_name(dmt);