On Tue, Nov 08, 2011 at 09:09:31AM -0500, Stefan Berger wrote: > On 11/03/2011 01:29 PM, Daniel P. Berrange wrote: > >From: "Daniel P. Berrange"<berrange@xxxxxxxxxx> > > > >Currently every caller of the brXXX APIs has to store the returned > >errno value and then raise an error message. This results in > >inconsistent error messages across drivers, additional burden on > >the callers and makes the error reporting inaccurate since it is > >hard to distinguish different scenarios from 1 errno value. > > > >* src/util/bridge.c: Raise errors instead of returning errnos > >* src/lxc/lxc_driver.c, src/network/bridge_driver.c, > > src/qemu/qemu_command.c, src/uml/uml_conf.c, > > src/uml/uml_driver.c: Remove error reporting code > >--- > > po/POTFILES.in | 1 + > > src/lxc/lxc_driver.c | 7 +- > > src/network/bridge_driver.c | 78 +++----------- > > src/qemu/qemu_command.c | 23 +---- > > src/uml/uml_conf.c | 28 +----- > > src/uml/uml_driver.c | 14 +-- > > src/util/bridge.c | 262 +++++++++++++++++++++++++++++-------------- > > 7 files changed, 196 insertions(+), 217 deletions(-) > > > >@@ -188,6 +217,8 @@ cleanup: > > int > > brDeleteBridge(const char *brname ATTRIBUTE_UNUSED) > > { > >+ virReportSystemError(errno, > >+ _("Unable to delete bridge %s"), brname); > > errno -> ENOSYS Fixed this and a few others, and the places where they reoccur in later patches. > >@@ -211,15 +242,17 @@ brAddInterface(const char *brname, > > struct ifreq ifr; > > > > if ((fd = brSetupControl(brname,&ifr))< 0) > >- return errno; > >+ return -1; > > > > if (!(ifr.ifr_ifindex = if_nametoindex(ifname))) { > >- ret = errno; > >+ virReportSystemError(errno, > >+ _("Unable to get interface index for %s"), ifname); > I don't see an errno being defined for if_nametoindex in case of > failure. Use ENODEV ? Yeah I see it just returns 0, so I used ENODEV 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 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list