sheepdog: check if '-o redundancy' is passed from user
authorLiu Yuan <namei.unix@gmail.com>
Sun, 8 Dec 2013 16:11:20 +0000 (00:11 +0800)
committerKevin Wolf <kwolf@redhat.com>
Fri, 13 Dec 2013 13:49:50 +0000 (14:49 +0100)
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>
block/sheepdog.c

index b4ae50f44ddf663bafe97b18d27e5566667ba988..d1c812df3d17c2c03d5bfc820c38968c0f3ab9ef 100644 (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++;