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

Eric Blake eblake at redhat.com
Tue Nov 27 17:46:44 UTC 2012


----- Original Message -----
> From: "Daniel P. Berrange" <berrange at 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 at 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.




More information about the libvir-list mailing list