]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Adjust logic checks in virshUpdateDiskXML
authorJohn Ferlan <jferlan@redhat.com>
Tue, 17 Dec 2019 15:43:24 +0000 (10:43 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 18 Dec 2019 22:21:51 +0000 (17:21 -0500)
Make it clearer that what we're trying to do is find @source and
@target_node so that the unattentive or code analysis utility
doesn't believe 'source' and 'target' could be found in the same
node element.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-domain.c

index 56137bdd740149163ce08898bceef6c40921c1fc..9d4cdd26dde8c006ff6713938d955227bd00a8be 100644 (file)
@@ -12476,10 +12476,9 @@ virshUpdateDiskXML(xmlNodePtr disk_node,
         if (tmp->type != XML_ELEMENT_NODE)
             continue;
 
-        if (virXMLNodeNameEqual(tmp, "source"))
+        if (!source && virXMLNodeNameEqual(tmp, "source"))
             source = tmp;
-
-        if (virXMLNodeNameEqual(tmp, "target"))
+        else if (!target_node && virXMLNodeNameEqual(tmp, "target"))
             target_node = tmp;
 
         /*