[libvirt] [PATCH 5/8] virsh: Resolve Coverity DEADCODE

John Ferlan jferlan at redhat.com
Sat Sep 13 13:27:42 UTC 2014


Coverity complains that on the first pass through the for loop that
'params' cannot be true, thus the ternary setting to "&" cannot be
done - which is I believe true - thus this really is a deadcode
situation.

It doesn't complain on the following comparison for "spice" - of course
because we've set params = true now. I believe that's correct since we're
putting together the line and the first "param" sets the "?" while the rest
use "&".

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 tools/virsh-domain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index f80741c..a040e27 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9824,6 +9824,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
 
         /* TLS Port */
         if (tls_port) {
+            /* coverity[dead_error_condition] */
             virBufferAsprintf(&buf,
                               "%stls-port=%d",
                               params ? "&" : "?",
-- 
1.9.3




More information about the libvir-list mailing list