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

[Libvir] PATCH: Fix uninitialized variable & bridge setup



Two crazy bugs

 - I forgot an =0 initialization in a recent patch to deal with qemu startup
 - If you don't have any virtual networks defined, then libvirt_qemud will
   never called  brctlInit()  so trying to start a guest using bridged 
   network will get EINVAL.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
Index: qemud/conf.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/conf.c,v
retrieving revision 1.50
diff -u -p -r1.50 conf.c
--- qemud/conf.c	3 May 2007 16:10:40 -0000	1.50
+++ qemud/conf.c	11 May 2007 18:38:17 -0000
@@ -246,7 +246,7 @@ static int qemudExtractVersionInfo(const
         _exit(-1); /* Just in case */
     } else { /* Parent */
         char help[8192]; /* Ought to be enough to hold QEMU help screen */
-        int got, ret = -1;
+        int got = 0, ret = -1;
         int major, minor, micro;
 
         if (close(newstdout[1]) < 0)
@@ -1152,6 +1152,12 @@ qemudNetworkIfaceConnect(struct qemud_se
         goto error;
     }
 
+    if (!server->brctl && (err = brInit(&server->brctl))) {
+        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                         "cannot initialize bridge support: %s", strerror(err));
+        goto error;
+    }
+
     if ((err = brAddTap(server->brctl, brname,
                         ifname, BR_IFNAME_MAXLEN, &tapfd))) {
         qemudReportError(server, VIR_ERR_INTERNAL_ERROR,

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