[PATCH] virNetworkDHCPLeaseTimeDefParseXML: Output error when 'expiry' can't be parsed

Laine Stump laine at laine.org
Fri Jan 22 03:50:16 UTC 2021


On 1/21/21 11:40 AM, Peter Krempa wrote:
> virStrToLong_ul doesn't report it's own error.
>
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1918674
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>


Reviewed-by: Laine Stump <laine at redhat.com>

> ---
>   src/conf/network_conf.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index 4f1115e103..ff7a56f4f4 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c
> @@ -418,8 +418,11 @@ virNetworkDHCPLeaseTimeDefParseXML(virNetworkDHCPLeaseTimeDefPtr *lease,
>       if (!(expirystr = virXMLPropString(node, "expiry")))
>           return 0;
>
> -    if (virStrToLong_ul(expirystr, NULL, 10, &expiry) < 0)
> +    if (virStrToLong_ul(expirystr, NULL, 10, &expiry) < 0) {
> +        virReportError(VIR_ERR_XML_ERROR,
> +                       _("failed to parse expiry value '%s'"), expirystr);
>           return -1;
> +    }
>
>       if ((unitstr = virXMLPropString(node, "unit"))) {
>           if ((unit = virNetworkDHCPLeaseTimeUnitTypeFromString(unitstr)) < 0) {





More information about the libvir-list mailing list