]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: storage: Fix crash of libvirtd on network backed guest block-pull
authorPeter Krempa <pkrempa@redhat.com>
Thu, 29 May 2014 14:46:38 +0000 (16:46 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 29 May 2014 14:51:05 +0000 (16:51 +0200)
For guests backed by gluster volumes (or other network storage) we don't
fill the backing chain (see qemuDomainDetermineDiskChain). This leaves
the "relPath" field of the top image NULL. This causes a crash in
virStorageFileChainLookup() when looking up a backing element for such a
disk.

Since I'm working on adding support for network storage and one of the
steps will make the "relPath" field optional let's use STREQ_NULLABLE
instead of STREQ in virStorageFileChainLookup() to avoid the problem.

src/util/virstoragefile.c

index 2feda67699e9d5437b950c0689d9d5b4826a7fe0..c9b6187fc724e5e5222d0750a0033ea6187def64 100644 (file)
@@ -1591,7 +1591,7 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
             if (idx == i)
                 break;
         } else {
-            if (STREQ(name, chain->relPath))
+            if (STREQ_NULLABLE(name, chain->relPath))
                 break;
             if (nameIsFile && (chain->type == VIR_STORAGE_TYPE_FILE ||
                                chain->type == VIR_STORAGE_TYPE_BLOCK)) {