From ce7af78e3907c7462aa88d58facdc4ce7e0acd8d Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 17 Dec 2019 10:43:24 -0500 Subject: [PATCH] virsh: Adjust logic checks in virshUpdateDiskXML 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 Reviewed-by: Michal Privoznik --- tools/virsh-domain.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 56137bdd74..9d4cdd26dd 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -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; /*