Patchwork [13/19] monitor: Make "commit FOO" complain when FOO doesn't exist

login
register
mail settings
Submitter Kevin Wolf
Date June 15, 2010, 2:19 p.m.
Message ID <1276611581-3757-14-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/55696/
State New
Headers show

Comments

Kevin Wolf - June 15, 2010, 2:19 p.m.
From: Markus Armbruster <armbru@redhat.com>

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 blockdev.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/blockdev.c b/blockdev.c
index d74cd1d..f636bc6 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -493,9 +493,11 @@  void do_commit(Monitor *mon, const QDict *qdict)
         bdrv_commit_all();
     } else {
         bs = bdrv_find(device);
-        if (bs) {
-            bdrv_commit(bs);
+        if (!bs) {
+            qerror_report(QERR_DEVICE_NOT_FOUND, device);
+            return;
         }
+        bdrv_commit(bs);
     }
 }