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

Re: [libvirt] [PATCH v2 06/21] conf: Improve error handling in virDomainChrDefFormat()



On Tue, Nov 21, 2017 at 05:42:16PM +0100, Andrea Bolognani wrote:
> We don't need to store the return value since we never modify it; we
> should also report failure when virDomainChrSourceDefFormat() fails.
> 
> Signed-off-by: Andrea Bolognani <abologna redhat com>
> ---
>  src/conf/domain_conf.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 224b88d9a..cb4ed6ef6 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -24025,8 +24025,6 @@ virDomainChrDefFormat(virBufferPtr buf,
>      const char *elementName = virDomainChrDeviceTypeToString(def->deviceType);
>      bool tty_compat;
>  
> -    int ret = 0;
> -
>      if (!elementName) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("unexpected char device type %d"),
> @@ -24044,7 +24042,9 @@ virDomainChrDefFormat(virBufferPtr buf,
>      if (virDomainChrAttrsDefFormat(buf, def->source, tty_compat) < 0)
>          return -1;
>      virBufferAddLit(buf, ">\n");
> -    virDomainChrSourceDefFormat(buf, def->source, flags);
> +
> +    if (virDomainChrSourceDefFormat(buf, def->source, flags) < 0)
> +       return -1;

This change could be separated and all other calls of that function
should be checked for error since none of them are checked.

Pavel

Attachment: signature.asc
Description: PGP signature


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