[libvirt] [PATCH] qemuDomainDetermineDiskChain: initialize ret as -1

Peter Krempa pkrempa at redhat.com
Sun Jul 31 11:21:41 UTC 2016


On Sat, Jul 30, 2016 at 16:08:40 +0800, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao at gmail.com>

Some words to justify this change would be helpful.

> 
> Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
> ---
>  src/qemu/qemu_domain.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 9b439df..35d4365 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -4394,7 +4394,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
>                               bool report_broken)
>  {
>      virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
> -    int ret = 0;
> +    int ret = -1;
>      uid_t uid;
>      gid_t gid;

Not visible in this context are two cases where this function shall
return success but would return failure in this case.

>  
> @@ -4416,6 +4416,8 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
>                                    report_broken) < 0)
>          ret = -1;
>  
> +    ret = 0;

This would overwrite the previous error.

NACK, the code is okay as-is and there's no justification for the
change.

Peter




More information about the libvir-list mailing list