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

Daniel P. Berrange berrange at redhat.com
Tue Nov 27 17:56:11 UTC 2012


On Tue, Nov 27, 2012 at 12:46:44PM -0500, Eric Blake wrote:
> ----- 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.

Hmm, good point. I'll delete all this code

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list