Patchwork do_snapshot_blkdev() error on missing snapshot_file argument

login
register
mail settings
Submitter Jes Sorensen
Date Jan. 6, 2011, 4:02 p.m.
Message ID <1294329743-4844-1-git-send-email-Jes.Sorensen@redhat.com>
Download mbox | patch
Permalink /patch/77733/
State New
Headers show

Comments

Jes Sorensen - Jan. 6, 2011, 4:02 p.m.
From: Jes Sorensen <Jes.Sorensen@redhat.com>

Current code does not support snapshot internally to the running
image. Error in case no snapshot_file is specified.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 blockdev.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Kevin Wolf - Jan. 11, 2011, 12:16 p.m.
Am 06.01.2011 17:02, schrieb Jes.Sorensen@redhat.com:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> Current code does not support snapshot internally to the running
> image. Error in case no snapshot_file is specified.
> 
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>

Thanks, applied to the block branch.

Kevin

Patch

diff --git a/blockdev.c b/blockdev.c
index d7add36..662f7a9 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -526,6 +526,12 @@  int do_snapshot_blkdev(Monitor *mon, const QDict *qdict, QObject **ret_data)
     int ret = 0;
     int flags;
 
+    if (!filename) {
+        qerror_report(QERR_MISSING_PARAMETER, "snapshot_file");
+        ret = -1;
+        goto out;
+    }
+
     bs = bdrv_find(device);
     if (!bs) {
         qerror_report(QERR_DEVICE_NOT_FOUND, device);