[libvirt] [PATCH 1/2] qemu: Report error on unexpected job stats type

Peter Krempa pkrempa at redhat.com
Fri Jun 1 15:31:02 UTC 2018


On Fri, Jun 01, 2018 at 10:46:02 +0200, Jiri Denemark wrote:
> If we ever fail to properly set jobinfo->statsType,
> qemuDomainJobInfoToParams would return -1 without setting an error.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  src/qemu/qemu_domain.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 2c51e4c0d8..360379b26c 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -717,10 +717,12 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
>          return qemuDomainDumpJobInfoToParams(jobInfo, type, params, nparams);
>  
>      case QEMU_DOMAIN_JOB_STATS_TYPE_NONE:
> -        break;
> +    default:
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("unexpected type of job stats: %d"),
> +                       jobInfo->statsType);

virReportEnumRangeError?

> +        return -1;

ACK, ... 


>      }
> -
> -    return -1;

.. but only push it during the freeze with the above part dropped. I'm
not going to second-guess which compiler decides that the function will
be missing a return statement.


>  }
>  
>  
> -- 
> 2.17.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180601/b51be103/attachment-0001.sig>


More information about the libvir-list mailing list