[PATCH v2 4/10] parallels: Need to handle virJSONValueObjectGetString error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/parallels/parallels_driver.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index ea193af..1b47246 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -513,10 +513,9 @@ parallelsGetNetInfo(virDomainNetDefPtr net,
     }
 
     net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP;
-    if (virJSONValueObjectHasKey(value, "state")) {
-        tmp = virJSONValueObjectGetString(value, "state");
-        if STREQ(tmp, "disconnected")
-            net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
+    if ((tmp = virJSONValueObjectGetString(value, "state")) &&
+        STREQ(tmp, "disconnected")) {
+        net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
     }
 
     return 0;
-- 
1.7.11.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]