summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorShahar Havivi <shaharh@redhat.com>2010-03-06 00:26:13 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-17 10:41:38 -0500
commitfd04a2aedae37dc9f481225f445d04bddd1590b0 (patch)
treef3e5b92e299050cf4c590c2fcbe992178ba31185 /block.c
parent25b28f01d840c56c1323f2bb941da061a8003176 (diff)
downloadqemu-fd04a2aedae37dc9f481225f445d04bddd1590b0.tar.gz
qemu-fd04a2aedae37dc9f481225f445d04bddd1590b0.tar.bz2
qemu-fd04a2aedae37dc9f481225f445d04bddd1590b0.zip
Wrong error message in block_passwd command
Signed-off-by: Shahar Havivi <shaharh@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/block.c b/block.c
index 31d1ba4bfd..e891544dd1 100644
--- a/block.c
+++ b/block.c
@@ -1134,8 +1134,11 @@ int bdrv_set_key(BlockDriverState *bs, const char *key)
if (!bs->encrypted)
return 0;
}
- if (!bs->encrypted || !bs->drv || !bs->drv->bdrv_set_key)
- return -1;
+ if (!bs->encrypted) {
+ return -EINVAL;
+ } else if (!bs->drv || !bs->drv->bdrv_set_key) {
+ return -ENOMEDIUM;
+ }
ret = bs->drv->bdrv_set_key(bs, key);
if (ret < 0) {
bs->valid_key = 0;