Re: [PATCH] virsh: report errors in virshInit()

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

 




On 04/19/2017 06:43 AM, Daniel P. Berrange wrote:
> There are several functions in virshInit which can fail, especially
> when running win32 builds under WINE. Currently virsh just exits
> without reporting what error happened.
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  tools/virsh.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 

Why not a "goto error;" instead where error: does the
vshReportError(ctl); return false;

ACK either way

John

> diff --git a/tools/virsh.c b/tools/virsh.c
> index 31e23bd..90f8125 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -358,16 +358,22 @@ virshInit(vshControl *ctl)
>      /* set up the library error handler */
>      virSetErrorFunc(NULL, vshErrorHandler);
>  
> -    if (virEventRegisterDefaultImpl() < 0)
> +    if (virEventRegisterDefaultImpl() < 0) {
> +        vshReportError(ctl);
>          return false;
> +    }
>  
> -    if (virThreadCreate(&ctl->eventLoop, true, vshEventLoop, ctl) < 0)
> +    if (virThreadCreate(&ctl->eventLoop, true, vshEventLoop, ctl) < 0) {
> +        vshReportError(ctl);
>          return false;
> +    }
>      ctl->eventLoopStarted = true;
>  
>      if ((ctl->eventTimerId = virEventAddTimeout(-1, vshEventTimeout, ctl,
> -                                                NULL)) < 0)
> +                                                NULL)) < 0) {
> +        vshReportError(ctl);
>          return false;
> +    }
>  
>      if (ctl->connname) {
>          /* Connecting to a named connection must succeed, but we delay
> 

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