aboutsummaryrefslogtreecommitdiff
path: root/block/sheepdog.c
diff options
context:
space:
mode:
authorLiu Yuan <namei.unix@gmail.com>2013-12-09 00:11:20 +0800
committerKevin Wolf <kwolf@redhat.com>2013-12-13 14:49:50 +0100
commita3120deee5fc1d702ba5da98fd9c845ad1c8f301 (patch)
tree2920245681d7674ba597cc87f4c99463c54a1ec4 /block/sheepdog.c
parent47acdd63a33a5966bf4fc94a6ac835d72a70c555 (diff)
sheepdog: check if '-o redundancy' is passed from user
This fix a segfault (that is caused by b3af018f3) of following command: $ qemu-img convert some_img sheepdog:some_img Cc: qemu-devel@nongnu.org Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/sheepdog.c')
-rw-r--r--block/sheepdog.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c
index b4ae50f44d..d1c812df3d 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1666,9 +1666,11 @@ static int sd_create(const char *filename, QEMUOptionParameter *options,
goto out;
}
} else if (!strcmp(options->name, BLOCK_OPT_REDUNDANCY)) {
- ret = parse_redundancy(s, options->value.s);
- if (ret < 0) {
- goto out;
+ if (options->value.s) {
+ ret = parse_redundancy(s, options->value.s);
+ if (ret < 0) {
+ goto out;
+ }
}
}
options++;