[PATCH] network_conf.c: correct the value of the 'result' variable

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

 



The result variable in virNetworkDNSDefFormat() function should be
initialized to -1 at first,only in this way can we use it properly.

Signed-off-by: Hongwei Bi <hwbi2008@xxxxxxxxx>
---
 src/conf/network_conf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 447eca4..8ab4e96 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2295,7 +2295,7 @@ static int
 virNetworkDNSDefFormat(virBufferPtr buf,
                        const virNetworkDNSDef *def)
 {
-    int result = 0;
+    int result = -1;
     size_t i, j;
 
     if (!(def->forwardPlainNames || def->forwarders || def->nhosts ||
@@ -2363,6 +2363,8 @@ virNetworkDNSDefFormat(virBufferPtr buf,
     }
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</dns>\n");
+
+    result = 0;
 out:
     return result;
 }
-- 
1.8.1.2

--
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]