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>
This commit is contained in:
Liu Yuan 2013-12-09 00:11:20 +08:00 committed by Kevin Wolf
parent 47acdd63a3
commit a3120deee5

View file

@ -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++;