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

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

 



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@xxxxxxxxxx>
> ---
>  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

--
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]
  Powered by Linux