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(a)gmail.com>
---
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