Re: [libvirt] [PATCH] test: Throw a proper error in GetBridgeName

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

 



On Fri, Oct 02, 2009 at 02:19:11PM -0400, Cole Robinson wrote:
> Throw error in GetBridgeName if net has no bridge.
> 
> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
> ---
>  src/test/test_driver.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index f57c92a..30014fc 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;
>      }

  ACK too !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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