mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: remove unneeded cleanup labels
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
committed by
Michal Privoznik
parent
adf9c3f952
commit
3a085d221e
@@ -41,7 +41,6 @@ testGetHostByName(const void *opaque)
|
||||
{
|
||||
const struct testNSSData *data = opaque;
|
||||
const bool existent = data->hostname && data->ipAddr && data->ipAddr[0];
|
||||
int ret = -1;
|
||||
struct hostent resolved;
|
||||
char buf[BUF_SIZE] = { 0 };
|
||||
char **addrList;
|
||||
@@ -64,16 +63,16 @@ testGetHostByName(const void *opaque)
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Resolving of %s failed due to internal error",
|
||||
data->hostname);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
} else if (rv == NSS_STATUS_NOTFOUND) {
|
||||
/* Resolving failed. Should it? */
|
||||
if (!existent)
|
||||
ret = 0;
|
||||
return 0;
|
||||
else
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Resolving of %s failed",
|
||||
data->hostname);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Resolving succeeded. Should it? */
|
||||
@@ -81,7 +80,7 @@ testGetHostByName(const void *opaque)
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Resolving of %s succeeded but was expected to fail",
|
||||
data->hostname);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Now lets see if resolved address match our expectations. */
|
||||
@@ -89,7 +88,7 @@ testGetHostByName(const void *opaque)
|
||||
if (!resolved.h_name) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
"resolved.h_name empty");
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (data->af != AF_UNSPEC &&
|
||||
@@ -97,7 +96,7 @@ testGetHostByName(const void *opaque)
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Expected AF_INET (%d) got %d",
|
||||
data->af, resolved.h_addrtype);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((resolved.h_addrtype == AF_INET && resolved.h_length != 4) ||
|
||||
@@ -107,13 +106,13 @@ testGetHostByName(const void *opaque)
|
||||
"Expected %d bytes long address, got %d",
|
||||
resolved.h_addrtype == AF_INET ? 4 : 16,
|
||||
resolved.h_length);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!resolved.h_addr_list) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
"resolved.h_addr_list empty");
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
addrList = resolved.h_addr_list;
|
||||
@@ -133,7 +132,7 @@ testGetHostByName(const void *opaque)
|
||||
|
||||
if (!(ipAddr = virSocketAddrFormat(&sa))) {
|
||||
/* error reported by helper */
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (STRNEQ_NULLABLE(data->ipAddr[i], ipAddr)) {
|
||||
@@ -141,7 +140,7 @@ testGetHostByName(const void *opaque)
|
||||
"Unexpected address %s, expecting %s",
|
||||
ipAddr, NULLSTR(data->ipAddr[i]));
|
||||
VIR_FREE(ipAddr);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(ipAddr);
|
||||
|
||||
@@ -153,12 +152,10 @@ testGetHostByName(const void *opaque)
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Expected %s address, got NULL",
|
||||
data->ipAddr[i]);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user