From 3c4b8a7706484244533052ed9c4da3361ea6bc2e Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 23 Sep 2009 11:54:48 -0400 Subject: [PATCH] test: Throw a proper error in GetBridgeName Throw error in GetBridgeName if net has no bridge. Signed-off-by: Cole Robinson --- src/test/test_driver.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index f57c92a4e8..30014fc1fc 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -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; } -- GitLab