[libvirt] PATCH: Fix check for inactive network

Daniel P. Berrange berrange at redhat.com
Fri Jun 6 13:31:10 UTC 2008


When building up the QEMU command line args we forgot to check for a NULL
when creating the TAP device arg. This can happen if the network being
connected to the VM is not running. This is something I broke in the
refactoring of the ARGV construction in the QEMU driver.

Dan.

Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.76
diff -u -p -r1.76 qemu_conf.c
--- src/qemu_conf.c	29 May 2008 19:20:23 -0000	1.76
+++ src/qemu_conf.c	6 Jun 2008 13:29:17 -0000
@@ -2679,8 +2679,13 @@ int qemudBuildCommandLine(virConnectPtr 
             switch (net->type) {
             case QEMUD_NET_NETWORK:
             case QEMUD_NET_BRIDGE:
-                ADD_ARG(qemudNetworkIfaceConnect(conn, driver, vm, net, vlan));
-                break;
+                {
+                    char *tap = qemudNetworkIfaceConnect(conn, driver, vm, net, vlan);
+                    if (tap == NULL)
+                        goto error;
+                    ADD_ARG(tap);
+                    break;
+                }
 
             case QEMUD_NET_ETHERNET:
                 {


-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list