Re: [PATCH 07/33] Remove usage of brctl command line tool

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

 



On Tue, Nov 08, 2011 at 09:48:34AM -0500, Stefan Berger wrote:
> On 11/03/2011 01:30 PM, Daniel P. Berrange wrote:
> >From: "Daniel P. Berrange"<berrange@xxxxxxxxxx>
> >
> >Convert the virNetDevBridgeSetSTP and virNetDevBridgeSetSTPDelay
> >to use ioctls instead of spawning brctl.
> >
> >Implement the virNetDevBridgeGetSTP and virNetDevBridgeGetSTPDelay
> >methods which were declared in the header but never existed
> >
> >* src/util/bridge.c: Convert to use bridge ioctls instead of brctl
> >---
> >  configure.ac      |    2 -
> >  libvirt.spec.in   |    2 -
> >  src/util/bridge.c |  199 +++++++++++++++++++++++++++++++++++++++++++++++++----
> >  3 files changed, 184 insertions(+), 19 deletions(-)

> >@@ -817,22 +924,54 @@ cleanup:
> >  int virNetDevBridgeSetSTPDelay(const char *brname,
> >                                 int delay)
> >  {
> >-    virCommandPtr cmd;
> >+    int fd = -1;
>
> Also applicable for the other patches, the initialization to -1
> doesn't seem necessary.

I prefer to be overly cautious when declaring file descriptor variables.
Even though the current code will always initialize FD, someone might
come along later and refactor the method, resulting in code which needs
the -1 initialization at declaration.  GCC is not entirely reliable at
detecting use of uninitialized variables.

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


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