On 08/19/2011 09:08 PM, Eric Blake wrote:
I got confused when 'virsh domblkinfo dom disk' required the
path to a disk (which can be ambiguous, since a single file
can back multiple disks), rather than the unambiguous target
device name that I was using in disk snapshots. So, in true
developer fashion, I went for the best of both worlds - all
interfaces that operate on a disk (aka block) now accept
either the target name or the unambiguous path to the backing
file used by the disk.
@@ -11284,6 +11312,13 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
disk->file, disk->name);
goto cleanup;
}
+ if (STRNEQ(disk->file, def->dom->disks[idx]->dst)) {
+ VIR_FREE(disk->file);
+ if (!(disk->file = strdup(def->dom->disks[idx]->dst))) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ }
I got a NULL deref in testing, and traced it to the use of the wrong
field. Squash this in (I promise to post a clean v3 of the entire
series once I flush out more of these little fixups).
diff --git i/src/conf/domain_conf.c w/src/conf/domain_conf.c
index aa5f2d3..effc2a3 100644
--- i/src/conf/domain_conf.c
+++ w/src/conf/domain_conf.c
@@ -11314,9 +11314,9 @@
virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
disk->file, disk->name);
goto cleanup;
}
- if (STRNEQ(disk->file, def->dom->disks[idx]->dst)) {
- VIR_FREE(disk->file);
- if (!(disk->file = strdup(def->dom->disks[idx]->dst))) {
+ if (STRNEQ(disk->name, def->dom->disks[idx]->dst)) {
+ VIR_FREE(disk->name);
+ if (!(disk->name = strdup(def->dom->disks[idx]->dst))) {
virReportOOMError();
goto cleanup;
}
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org