[libvirt] [PATCH] build: avoid compiler warning

Eric Blake eblake at redhat.com
Tue Jan 8 15:30:08 UTC 2013


gcc 4.1.2 on RHEL 5 warned:
conf/network_conf.c:3136: warning: 'foundIdx' may be used uninitialized in this function

The warning is spurious, but initializing the variable doesn't hurt.

* src/conf/network_conf.c (virNetworkDefUpdateDNSHost): Silence
unused variable warning.
---

Pushing under the build-breaker rule.

 src/conf/network_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index d185b46..48639a9 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -3133,7 +3133,7 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
                            /* virNetworkUpdateFlags */
                            unsigned int fflags ATTRIBUTE_UNUSED)
 {
-    int ii, jj, kk, foundIdx, ret = -1;
+    int ii, jj, kk, foundIdx = -1, ret = -1;
     virNetworkDNSDefPtr dns = &def->dns;
     virNetworkDNSHostDef host;
     bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
-- 
1.8.0.2




More information about the libvir-list mailing list