]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test: Throw a proper error in GetBridgeName
authorCole Robinson <crobinso@redhat.com>
Wed, 23 Sep 2009 15:54:48 +0000 (11:54 -0400)
committerCole Robinson <crobinso@redhat.com>
Mon, 5 Oct 2009 17:31:38 +0000 (13:31 -0400)
Throw error in GetBridgeName if net has no bridge.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/test/test_driver.c

index f57c92a4e8f82ffe05a273a1af699c5e97f4d723..30014fc1fcdd9dc3b663cfe24f23718812e994b7 100644 (file)
@@ -2546,8 +2546,14 @@ static char *testNetworkGetBridgeName(virNetworkPtr network) {
         goto cleanup;
     }
 
-    if (privnet->def->bridge &&
-        !(bridge = strdup(privnet->def->bridge))) {
+    if (!(privnet->def->bridge)) {
+        testError(network->conn, VIR_ERR_INTERNAL_ERROR,
+                  _("network '%s' does not have a bridge name."),
+                  privnet->def->name);
+        goto cleanup;
+    }
+
+    if (!(bridge = strdup(privnet->def->bridge))) {
         virReportOOMError(network->conn);
         goto cleanup;
     }