[libvirt] [PATCH] conf: return immediately on error in dhcp host element

Laine Stump laine at laine.org
Mon Mar 19 17:32:52 UTC 2012


If and error was encountered parsing a dhcp host entry mac address or
name, parsing would continue and log a less descriptive error that
might make it more difficult to notice the true nature of the problem.

This patch returns immediately on logging the first error.
---
 src/conf/network_conf.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 0333141..0fa58f8 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -430,6 +430,7 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
                                       _("Cannot parse MAC address '%s' in network '%s'"),
                                       mac, networkName);
                 VIR_FREE(mac);
+                return -1;
             }
             name = virXMLPropString(cur, "name");
             if ((name != NULL) && (!c_isalpha(name[0]))) {
@@ -437,6 +438,7 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
                                       _("Cannot use name address '%s' in network '%s'"),
                                       name, networkName);
                 VIR_FREE(name);
+                return -1;
             }
             /*
              * You need at least one MAC address or one host name
-- 
1.7.7.6




More information about the libvir-list mailing list