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

Re: [libvirt] [PATCH 09/10] Fix error reporting in virNetDevVethDelete



----- Original Message -----
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> In virNetDevVethDelete the virRun method will properly report
> errors, but when checking the exit status for non-zero exit
> code no error is reported
> 
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  po/POTFILES.in           |  1 +
>  src/util/virnetdevveth.c | 19 +++++++++----------
>  2 files changed, 10 insertions(+), 10 deletions(-)

I think this is overkill.

>      rc = virRun(argv, &cmdResult);
>  
> -    if (rc != 0 ||
> -        (WIFEXITED(cmdResult) && WEXITSTATUS(cmdResult) != 0)) {

The old code wants cmdResult to be exactly 0.  But guess what - if
you pass NULL to virRun, then virRun errors out unless the exit
status is exactly 0.

That is it is better to just do:

rc = virRun(argv, NULL);

and delete the rest of this attempt at warning about non-zero
status, as virRun does a better job of it in the first place.


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