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
1 changed files with 5 additions and 3 deletions

View File

@ -1666,9 +1666,11 @@ static int sd_create(const char *filename, QEMUOptionParameter *options,
goto out; goto out;
} }
} else if (!strcmp(options->name, BLOCK_OPT_REDUNDANCY)) { } else if (!strcmp(options->name, BLOCK_OPT_REDUNDANCY)) {
ret = parse_redundancy(s, options->value.s); if (options->value.s) {
if (ret < 0) { ret = parse_redundancy(s, options->value.s);
goto out; if (ret < 0) {
goto out;
}
} }
} }
options++; options++;