[libvirt] [PATCH] fix build with older gcc

Ján Tomko jtomko at redhat.com
Fri May 2 07:49:07 UTC 2014


Older gcc (4.1.2-55.el5, 4.2.1 on FreeBSD) reports bogus warnings:
../../src/conf/nwfilter_conf.c:2111: warning: 'protocol' may be used
uninitialized in this function
../../src/conf/nwfilter_conf.c:2110: warning: 'dataProtocolID' may be
used uninitialized in this function

Initialize them to NULL to make the compiler happy.
---

Pushed as a build-breaker fix.

 src/conf/nwfilter_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 67b5482..b9f6d51 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2107,8 +2107,8 @@ virNWFilterRuleValidate(virNWFilterRuleDefPtr rule)
 {
     int ret = 0;
     portDataDefPtr portData = NULL;
-    nwItemDescPtr dataProtocolID;
-    const char *protocol;
+    nwItemDescPtr dataProtocolID = NULL;
+    const char *protocol = NULL;
 
     switch (rule->prtclType) {
     case VIR_NWFILTER_RULE_PROTOCOL_IP:
-- 
1.8.3.2




More information about the libvir-list mailing list