]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: Use 'format' argument only when specified
authorPeter Krempa <pkrempa@redhat.com>
Fri, 16 Oct 2015 07:01:17 +0000 (09:01 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 16 Oct 2015 07:01:17 +0000 (09:01 +0200)
The condition checking whether --format was specified was incorrect.
virsh crashed if the following format was used:

 virsh dump VM dump --format '' --memory-only

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1272301

tools/virsh-domain.c

index 456e27322d9286b3746aff1306a97c777f4bd1b8..41915481be17ed1c87aed2304fd17e872c9f6f27 100644 (file)
@@ -5280,7 +5280,7 @@ doDump(void *opaque)
             goto out;
         }
 
-        if (vshCommandOptString(ctl, cmd, "format", &format)) {
+        if (vshCommandOptString(ctl, cmd, "format", &format) > 0) {
             if (STREQ(format, "kdump-zlib")) {
                 dumpformat = VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB;
             } else if (STREQ(format, "kdump-lzo")) {