The libvirt APIs reserve any negative value for indicating an
error. Thus checks
if (virXXXX() == -1)
Should instead be
if (virXXXX() < 0)
* daemon/remote.c: s/ == -1/ < 0/
---
daemon/remote.c | 339 +++++++++++++++++++++++++++++--------------------------
1 files changed, 180 insertions(+), 159 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 8f4d6a6..325ba90 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -476,7 +476,7 @@ remoteDispatchSupportsFeature(struct qemud_server *server
ATTRIBUTE_UNUSED,
ret->supported = virDrvSupportsFeature(conn, args->feature);
- if (ret->supported == -1) {
+ if (ret->supported < 0) {
goto cleanup;
}
@@ -543,7 +543,7 @@ remoteDispatchGetVersion(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virConnectGetVersion(conn, &hvVer) == -1) {
+ if (virConnectGetVersion(conn, &hvVer) < 0) {
goto cleanup;
}
@@ -573,7 +573,7 @@ remoteDispatchGetLibVersion(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virConnectGetLibVersion(conn, &libVer) == -1) {
+ if (virConnectGetLibVersion(conn, &libVer) < 0) {
goto cleanup;
}
@@ -700,7 +700,7 @@ remoteDispatchGetMaxVcpus(struct qemud_server *server
ATTRIBUTE_UNUSED,
type = args->type ? *args->type : NULL;
ret->max_vcpus = virConnectGetMaxVcpus(conn, type);
- if (ret->max_vcpus == -1) {
+ if (ret->max_vcpus < 0) {
goto cleanup;
}
@@ -729,7 +729,7 @@ remoteDispatchNodeGetInfo(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNodeGetInfo(conn, &info) == -1) {
+ if (virNodeGetInfo(conn, &info) < 0) {
goto cleanup;
}
@@ -938,7 +938,7 @@ remoteDispatchDomainGetSchedulerParameters(struct qemud_server *server
ATTRIBUTE
}
r = virDomainGetSchedulerParameters(dom, params, &nparams);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
@@ -1051,7 +1051,7 @@ remoteDispatchDomainSetSchedulerParameters(struct qemud_server
*server ATTRIBUTE
}
r = virDomainSetSchedulerParameters(dom, params, nparams);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
@@ -1091,7 +1091,7 @@ remoteDispatchDomainBlockStats(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
path = args->path;
- if (virDomainBlockStats(dom, path, &stats, sizeof stats) == -1) {
+ if (virDomainBlockStats(dom, path, &stats, sizeof stats) < 0) {
goto cleanup;
}
@@ -1136,7 +1136,7 @@ remoteDispatchDomainInterfaceStats(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
path = args->path;
- if (virDomainInterfaceStats(dom, path, &stats, sizeof stats) == -1) {
+ if (virDomainInterfaceStats(dom, path, &stats, sizeof stats) < 0) {
goto cleanup;
}
@@ -1170,7 +1170,7 @@ remoteDispatchDomainMemoryStats(struct qemud_server *server
ATTRIBUTE_UNUSED,
{
virDomainPtr dom = NULL;
struct _virDomainMemoryStat *stats;
- unsigned int nr_stats, i;
+ int nr_stats, i;
int rv = -1;
if (!conn) {
@@ -1196,7 +1196,7 @@ remoteDispatchDomainMemoryStats(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
nr_stats = virDomainMemoryStats(dom, stats, args->maxStats, 0);
- if (nr_stats == -1) {
+ if (nr_stats < 0) {
goto cleanup;
}
@@ -1266,7 +1266,7 @@ remoteDispatchDomainBlockPeek(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
if (virDomainBlockPeek(dom, path, offset, size,
- ret->buffer.buffer_val, flags) == -1) {
+ ret->buffer.buffer_val, flags) < 0) {
goto cleanup;
}
@@ -1323,7 +1323,7 @@ remoteDispatchDomainMemoryPeek(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
if (virDomainMemoryPeek(dom, offset, size,
- ret->buffer.buffer_val, flags) == -1) {
+ ret->buffer.buffer_val, flags) < 0) {
goto cleanup;
}
if (dom)
@@ -1363,7 +1363,7 @@ remoteDispatchDomainAttachDevice(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainAttachDevice(dom, args->xml) == -1) {
+ if (virDomainAttachDevice(dom, args->xml) < 0) {
goto cleanup;
}
@@ -1399,7 +1399,7 @@ remoteDispatchDomainAttachDeviceFlags(struct qemud_server *server
ATTRIBUTE_UNUS
goto cleanup;
}
- if (virDomainAttachDeviceFlags(dom, args->xml, args->flags) == -1) {
+ if (virDomainAttachDeviceFlags(dom, args->xml, args->flags) < 0) {
goto cleanup;
}
@@ -1435,7 +1435,7 @@ remoteDispatchDomainUpdateDeviceFlags(struct qemud_server *server
ATTRIBUTE_UNUS
goto cleanup;
}
- if (virDomainUpdateDeviceFlags(dom, args->xml, args->flags) == -1) {
+ if (virDomainUpdateDeviceFlags(dom, args->xml, args->flags) < 0) {
goto cleanup;
}
@@ -1471,7 +1471,7 @@ remoteDispatchDomainCreate(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainCreate(dom) == -1) {
+ if (virDomainCreate(dom) < 0) {
goto cleanup;
}
@@ -1502,7 +1502,7 @@ remoteDispatchDomainCreateWithFlags(struct qemud_server *server
ATTRIBUTE_UNUSED
goto cleanup;
}
- if (virDomainCreateWithFlags(dom, args->flags) == -1) {
+ if (virDomainCreateWithFlags(dom, args->flags) < 0) {
goto cleanup;
}
@@ -1608,7 +1608,7 @@ remoteDispatchDomainDestroy(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainDestroy(dom) == -1) {
+ if (virDomainDestroy(dom) < 0) {
goto cleanup;
}
@@ -1644,7 +1644,7 @@ remoteDispatchDomainDetachDevice(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainDetachDevice(dom, args->xml) == -1) {
+ if (virDomainDetachDevice(dom, args->xml) < 0) {
goto cleanup;
}
@@ -1680,7 +1680,7 @@ remoteDispatchDomainDetachDeviceFlags(struct qemud_server *server
ATTRIBUTE_UNUS
goto cleanup;
}
- if (virDomainDetachDeviceFlags(dom, args->xml, args->flags) == -1) {
+ if (virDomainDetachDeviceFlags(dom, args->xml, args->flags) < 0) {
goto cleanup;
}
@@ -1819,7 +1819,7 @@ remoteDispatchDomainGetAutostart(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainGetAutostart(dom, &ret->autostart) == -1) {
+ if (virDomainGetAutostart(dom, &ret->autostart) < 0) {
goto cleanup;
}
@@ -1856,7 +1856,7 @@ remoteDispatchDomainGetInfo(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainGetInfo(dom, &info) == -1) {
+ if (virDomainGetInfo(dom, &info) < 0) {
goto cleanup;
}
@@ -1936,7 +1936,7 @@ remoteDispatchDomainGetMaxVcpus(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virDomainGetMaxVcpus(dom);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -1978,7 +1978,7 @@ remoteDispatchDomainGetSecurityLabel(struct qemud_server *server
ATTRIBUTE_UNUSE
goto cleanup;
}
- if (virDomainGetSecurityLabel(dom, seclabel) == -1) {
+ if (virDomainGetSecurityLabel(dom, seclabel) < 0) {
goto cleanup;
}
@@ -2019,7 +2019,7 @@ remoteDispatchNodeGetSecurityModel(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
memset(&secmodel, 0, sizeof secmodel);
- if (virNodeGetSecurityModel(conn, &secmodel) == -1) {
+ if (virNodeGetSecurityModel(conn, &secmodel) < 0) {
goto cleanup;
}
@@ -2127,7 +2127,7 @@ remoteDispatchDomainGetVcpus(struct qemud_server *server
ATTRIBUTE_UNUSED,
info_len = virDomainGetVcpus(dom,
info, args->maxinfo,
cpumaps, args->maplen);
- if (info_len == -1) {
+ if (info_len < 0) {
goto cleanup;
}
@@ -2192,7 +2192,7 @@ remoteDispatchDomainGetVcpusFlags(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virDomainGetVcpusFlags(dom, args->flags);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -2240,7 +2240,7 @@ remoteDispatchDomainMigratePrepare(struct qemud_server *server
ATTRIBUTE_UNUSED,
r = virDomainMigratePrepare(conn, &cookie, &cookielen,
uri_in, uri_out,
args->flags, dname, args->resource);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
@@ -2296,7 +2296,7 @@ remoteDispatchDomainMigratePerform(struct qemud_server *server
ATTRIBUTE_UNUSED,
args->cookie.cookie_len,
args->uri,
args->flags, dname, args->resource);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
@@ -2382,7 +2382,7 @@ remoteDispatchDomainMigratePrepare2(struct qemud_server *server
ATTRIBUTE_UNUSED
uri_in, uri_out,
args->flags, dname, args->resource,
args->dom_xml);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
@@ -2470,7 +2470,7 @@ remoteDispatchDomainMigratePrepareTunnel(struct qemud_server *server
ATTRIBUTE_U
r = virDomainMigratePrepareTunnel(conn, stream->st,
args->flags, dname, args->resource,
args->dom_xml);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
@@ -2501,6 +2501,7 @@ remoteDispatchListDefinedDomains(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_list_defined_domains_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -2519,12 +2520,12 @@ remoteDispatchListDefinedDomains(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->names.names_len =
- virConnectListDefinedDomains(conn,
- ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virConnectListDefinedDomains(conn,
+ ret->names.names_val, args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -2655,7 +2656,7 @@ remoteDispatchNumOfDefinedDomains(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfDefinedDomains(conn);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -2697,7 +2698,7 @@ remoteDispatchDomainPinVcpu(struct qemud_server *server
ATTRIBUTE_UNUSED,
rv = virDomainPinVcpu(dom, args->vcpu,
(unsigned char *) args->cpumap.cpumap_val,
args->cpumap.cpumap_len);
- if (rv == -1) {
+ if (rv < 0) {
goto cleanup;
}
@@ -2733,7 +2734,7 @@ remoteDispatchDomainReboot(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainReboot(dom, args->flags) == -1) {
+ if (virDomainReboot(dom, args->flags) < 0) {
goto cleanup;
}
@@ -2763,7 +2764,7 @@ remoteDispatchDomainRestore(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainRestore(conn, args->from) == -1) {
+ if (virDomainRestore(conn, args->from) < 0) {
goto cleanup;
}
@@ -2797,7 +2798,7 @@ remoteDispatchDomainResume(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainResume(dom) == -1) {
+ if (virDomainResume(dom) < 0) {
goto cleanup;
}
@@ -2833,7 +2834,7 @@ remoteDispatchDomainSave(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainSave(dom, args->to) == -1) {
+ if (virDomainSave(dom, args->to) < 0) {
goto cleanup;
}
@@ -2869,7 +2870,7 @@ remoteDispatchDomainCoreDump(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainCoreDump(dom, args->to, args->flags) == -1) {
+ if (virDomainCoreDump(dom, args->to, args->flags) < 0) {
goto cleanup;
}
@@ -2905,7 +2906,7 @@ remoteDispatchDomainSetAutostart(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainSetAutostart(dom, args->autostart) == -1) {
+ if (virDomainSetAutostart(dom, args->autostart) < 0) {
goto cleanup;
}
@@ -2941,7 +2942,7 @@ remoteDispatchDomainSetMaxMemory(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainSetMaxMemory(dom, args->memory) == -1) {
+ if (virDomainSetMaxMemory(dom, args->memory) < 0) {
goto cleanup;
}
@@ -2977,7 +2978,7 @@ remoteDispatchDomainSetMemory(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainSetMemory(dom, args->memory) == -1) {
+ if (virDomainSetMemory(dom, args->memory) < 0) {
goto cleanup;
}
@@ -3013,7 +3014,7 @@ remoteDispatchDomainSetMemoryFlags(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainSetMemoryFlags(dom, args->memory, args->flags) == -1) {
+ if (virDomainSetMemoryFlags(dom, args->memory, args->flags) < 0) {
goto cleanup;
}
@@ -3112,7 +3113,7 @@ remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
}
r = virDomainSetMemoryParameters(dom, params, nparams, flags);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
@@ -3170,7 +3171,7 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
}
r = virDomainGetMemoryParameters(dom, params, &nparams, flags);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
/* In this case, we need to send back the number of parameters
@@ -3333,7 +3334,7 @@ remoteDispatchDomainSetBlkioParameters(struct qemud_server *server
}
r = virDomainSetBlkioParameters(dom, params, nparams, flags);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
@@ -3391,7 +3392,7 @@ remoteDispatchDomainGetBlkioParameters(struct qemud_server *server
}
r = virDomainGetBlkioParameters(dom, params, &nparams, flags);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
/* In this case, we need to send back the number of parameters
@@ -3493,7 +3494,7 @@ remoteDispatchDomainSetVcpus(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainSetVcpus(dom, args->nvcpus) == -1) {
+ if (virDomainSetVcpus(dom, args->nvcpus) < 0) {
goto cleanup;
}
@@ -3529,7 +3530,7 @@ remoteDispatchDomainSetVcpusFlags(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainSetVcpusFlags(dom, args->nvcpus, args->flags) == -1) {
+ if (virDomainSetVcpusFlags(dom, args->nvcpus, args->flags) < 0) {
goto cleanup;
}
@@ -3565,7 +3566,7 @@ remoteDispatchDomainShutdown(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainShutdown(dom) == -1) {
+ if (virDomainShutdown(dom) < 0) {
goto cleanup;
}
@@ -3601,7 +3602,7 @@ remoteDispatchDomainSuspend(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainSuspend(dom) == -1) {
+ if (virDomainSuspend(dom) < 0) {
goto cleanup;
}
@@ -3637,7 +3638,7 @@ remoteDispatchDomainUndefine(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainUndefine(dom) == -1) {
+ if (virDomainUndefine(dom) < 0) {
goto cleanup;
}
@@ -3661,6 +3662,7 @@ remoteDispatchListDefinedNetworks(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_list_defined_networks_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -3679,12 +3681,12 @@ remoteDispatchListDefinedNetworks(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->names.names_len =
- virConnectListDefinedNetworks(conn,
+ len = virConnectListDefinedNetworks(conn,
ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -3706,6 +3708,7 @@ remoteDispatchListDomains(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_list_domains_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -3724,11 +3727,12 @@ remoteDispatchListDomains(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->ids.ids_len = virConnectListDomains(conn,
- ret->ids.ids_val, args->maxids);
- if (ret->ids.ids_len == -1) {
+ len = virConnectListDomains(conn,
+ ret->ids.ids_val, args->maxids);
+ if (len < 0) {
goto cleanup;
}
+ ret->ids.ids_len = len;
rv = 0;
@@ -3762,7 +3766,7 @@ remoteDispatchDomainManagedSave(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainManagedSave(dom, args->flags) == -1) {
+ if (virDomainManagedSave(dom, args->flags) < 0) {
goto cleanup;
}
@@ -3799,7 +3803,7 @@ remoteDispatchDomainHasManagedSaveImage(struct qemud_server *server
ATTRIBUTE_UN
}
ret->ret = virDomainHasManagedSaveImage(dom, args->flags);
- if (ret->ret == -1) {
+ if (ret->ret < 0) {
goto cleanup;
}
@@ -3835,7 +3839,7 @@ remoteDispatchDomainManagedSaveRemove(struct qemud_server *server
ATTRIBUTE_UNUS
goto cleanup;
}
- if (virDomainManagedSaveRemove(dom, args->flags) == -1) {
+ if (virDomainManagedSaveRemove(dom, args->flags) < 0) {
goto cleanup;
}
@@ -3859,6 +3863,7 @@ remoteDispatchListNetworks(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_list_networks_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -3877,12 +3882,12 @@ remoteDispatchListNetworks(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->names.names_len =
- virConnectListNetworks(conn,
- ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virConnectListNetworks(conn,
+ ret->names.names_val, args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -3916,7 +3921,7 @@ remoteDispatchNetworkCreate(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNetworkCreate(net) == -1) {
+ if (virNetworkCreate(net) < 0) {
goto cleanup;
}
@@ -4020,7 +4025,7 @@ remoteDispatchNetworkDestroy(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNetworkDestroy(net) == -1) {
+ if (virNetworkDestroy(net) < 0) {
goto cleanup;
}
@@ -4094,7 +4099,7 @@ remoteDispatchNetworkGetAutostart(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNetworkGetAutostart(net, &ret->autostart) == -1) {
+ if (virNetworkGetAutostart(net, &ret->autostart) < 0) {
goto cleanup;
}
@@ -4236,7 +4241,7 @@ remoteDispatchNetworkSetAutostart(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNetworkSetAutostart(net, args->autostart) == -1) {
+ if (virNetworkSetAutostart(net, args->autostart) < 0) {
goto cleanup;
}
@@ -4272,7 +4277,7 @@ remoteDispatchNetworkUndefine(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNetworkUndefine(net) == -1) {
+ if (virNetworkUndefine(net) < 0) {
goto cleanup;
}
@@ -4296,16 +4301,18 @@ remoteDispatchNumOfDefinedNetworks(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_num_of_defined_networks_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
goto cleanup;
}
- ret->num = virConnectNumOfDefinedNetworks(conn);
- if (ret->num == -1) {
+ len = virConnectNumOfDefinedNetworks(conn);
+ if (len < 0) {
goto cleanup;
}
+ ret->num = len;
rv = 0;
@@ -4332,7 +4339,7 @@ remoteDispatchNumOfDomains(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfDomains(conn);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -4361,7 +4368,7 @@ remoteDispatchNumOfNetworks(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfNetworks(conn);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -4392,7 +4399,7 @@ remoteDispatchNumOfInterfaces(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfInterfaces(conn);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -4414,6 +4421,7 @@ remoteDispatchListInterfaces(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_list_interfaces_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -4432,12 +4440,12 @@ remoteDispatchListInterfaces(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->names.names_len =
- virConnectListInterfaces(conn,
- ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virConnectListInterfaces(conn,
+ ret->names.names_val, args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -4459,16 +4467,18 @@ remoteDispatchNumOfDefinedInterfaces(struct qemud_server *server
ATTRIBUTE_UNUSE
remote_num_of_defined_interfaces_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
goto cleanup;
}
- ret->num = virConnectNumOfDefinedInterfaces(conn);
- if (ret->num == -1) {
+ len = virConnectNumOfDefinedInterfaces(conn);
+ if (len < 0) {
goto cleanup;
}
+ ret->num = len;
rv = 0;
@@ -4488,6 +4498,7 @@ remoteDispatchListDefinedInterfaces(struct qemud_server *server
ATTRIBUTE_UNUSED
remote_list_defined_interfaces_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -4506,12 +4517,12 @@ remoteDispatchListDefinedInterfaces(struct qemud_server *server
ATTRIBUTE_UNUSED
goto cleanup;
}
- ret->names.names_len =
- virConnectListDefinedInterfaces(conn,
- ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virConnectListDefinedInterfaces(conn,
+ ret->names.names_val, args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -4685,7 +4696,7 @@ remoteDispatchInterfaceUndefine(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virInterfaceUndefine(iface) == -1) {
+ if (virInterfaceUndefine(iface) < 0) {
goto cleanup;
}
@@ -4721,7 +4732,7 @@ remoteDispatchInterfaceCreate(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virInterfaceCreate(iface, args->flags) == -1) {
+ if (virInterfaceCreate(iface, args->flags) < 0) {
goto cleanup;
}
@@ -4757,7 +4768,7 @@ remoteDispatchInterfaceDestroy(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virInterfaceDestroy(iface, args->flags) == -1) {
+ if (virInterfaceDestroy(iface, args->flags) < 0) {
goto cleanup;
}
@@ -5585,6 +5596,7 @@ remoteDispatchListDefinedStoragePools(struct qemud_server *server
ATTRIBUTE_UNUS
remote_list_defined_storage_pools_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -5603,12 +5615,12 @@ remoteDispatchListDefinedStoragePools(struct qemud_server *server
ATTRIBUTE_UNUS
goto cleanup;
}
- ret->names.names_len =
- virConnectListDefinedStoragePools(conn,
- ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virConnectListDefinedStoragePools(conn,
+ ret->names.names_val, args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -5630,6 +5642,7 @@ remoteDispatchListStoragePools(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_list_storage_pools_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -5648,12 +5661,12 @@ remoteDispatchListStoragePools(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->names.names_len =
- virConnectListStoragePools(conn,
- ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virConnectListStoragePools(conn,
+ ret->names.names_val, args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -5721,7 +5734,7 @@ remoteDispatchStoragePoolCreate(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStoragePoolCreate(pool, args->flags) == -1) {
+ if (virStoragePoolCreate(pool, args->flags) < 0) {
goto cleanup;
}
@@ -5825,7 +5838,7 @@ remoteDispatchStoragePoolBuild(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStoragePoolBuild(pool, args->flags) == -1) {
+ if (virStoragePoolBuild(pool, args->flags) < 0) {
goto cleanup;
}
@@ -5862,7 +5875,7 @@ remoteDispatchStoragePoolDestroy(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStoragePoolDestroy(pool) == -1) {
+ if (virStoragePoolDestroy(pool) < 0) {
goto cleanup;
}
@@ -5898,7 +5911,7 @@ remoteDispatchStoragePoolDelete(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStoragePoolDelete(pool, args->flags) == -1) {
+ if (virStoragePoolDelete(pool, args->flags) < 0) {
goto cleanup;
}
@@ -5934,7 +5947,7 @@ remoteDispatchStoragePoolRefresh(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStoragePoolRefresh(pool, args->flags) == -1) {
+ if (virStoragePoolRefresh(pool, args->flags) < 0) {
goto cleanup;
}
@@ -5971,7 +5984,7 @@ remoteDispatchStoragePoolGetInfo(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStoragePoolGetInfo(pool, &info) == -1) {
+ if (virStoragePoolGetInfo(pool, &info) < 0) {
goto cleanup;
}
@@ -6050,7 +6063,7 @@ remoteDispatchStoragePoolGetAutostart(struct qemud_server *server
ATTRIBUTE_UNUS
goto cleanup;
}
- if (virStoragePoolGetAutostart(pool, &ret->autostart) == -1) {
+ if (virStoragePoolGetAutostart(pool, &ret->autostart) < 0) {
goto cleanup;
}
@@ -6197,7 +6210,7 @@ remoteDispatchStoragePoolSetAutostart(struct qemud_server *server
ATTRIBUTE_UNUS
goto cleanup;
}
- if (virStoragePoolSetAutostart(pool, args->autostart) == -1) {
+ if (virStoragePoolSetAutostart(pool, args->autostart) < 0) {
goto cleanup;
}
@@ -6233,7 +6246,7 @@ remoteDispatchStoragePoolUndefine(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStoragePoolUndefine(pool) == -1) {
+ if (virStoragePoolUndefine(pool) < 0) {
goto cleanup;
}
@@ -6264,7 +6277,7 @@ remoteDispatchNumOfStoragePools(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfStoragePools(conn);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -6293,7 +6306,7 @@ remoteDispatchNumOfDefinedStoragePools(struct qemud_server *server
ATTRIBUTE_UNU
}
ret->num = virConnectNumOfDefinedStoragePools(conn);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -6316,6 +6329,7 @@ remoteDispatchStoragePoolListVolumes(struct qemud_server *server
ATTRIBUTE_UNUSE
{
virStoragePoolPtr pool = NULL;
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -6339,12 +6353,12 @@ remoteDispatchStoragePoolListVolumes(struct qemud_server *server
ATTRIBUTE_UNUSE
goto cleanup;
}
- ret->names.names_len =
- virStoragePoolListVolumes(pool,
- ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virStoragePoolListVolumes(pool,
+ ret->names.names_val, args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -6382,7 +6396,7 @@ remoteDispatchStoragePoolNumOfVolumes(struct qemud_server *server
ATTRIBUTE_UNUS
}
ret->num = virStoragePoolNumOfVolumes(pool);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -6516,7 +6530,7 @@ remoteDispatchStorageVolDelete(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStorageVolDelete(vol, args->flags) == -1) {
+ if (virStorageVolDelete(vol, args->flags) < 0) {
goto cleanup;
}
@@ -6552,7 +6566,7 @@ remoteDispatchStorageVolWipe(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStorageVolWipe(vol, args->flags) == -1) {
+ if (virStorageVolWipe(vol, args->flags) < 0) {
goto cleanup;
}
@@ -6589,7 +6603,7 @@ remoteDispatchStorageVolGetInfo(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStorageVolGetInfo(vol, &info) == -1) {
+ if (virStorageVolGetInfo(vol, &info) < 0) {
goto cleanup;
}
@@ -6820,7 +6834,7 @@ remoteDispatchNodeNumOfDevices(struct qemud_server *server
ATTRIBUTE_UNUSED,
ret->num = virNodeNumOfDevices(conn,
args->cap ? *args->cap : NULL,
args->flags);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -6843,6 +6857,7 @@ remoteDispatchNodeListDevices(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_node_list_devices_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -6861,13 +6876,13 @@ remoteDispatchNodeListDevices(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->names.names_len =
- virNodeListDevices(conn,
- args->cap ? *args->cap : NULL,
- ret->names.names_val, args->maxnames, args->flags);
- if (ret->names.names_len == -1) {
+ len = virNodeListDevices(conn,
+ args->cap ? *args->cap : NULL,
+ ret->names.names_val, args->maxnames,
args->flags);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -7056,6 +7071,7 @@ remoteDispatchNodeDeviceListCaps(struct qemud_server *server
ATTRIBUTE_UNUSED,
{
virNodeDevicePtr dev = NULL;
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -7079,12 +7095,12 @@ remoteDispatchNodeDeviceListCaps(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->names.names_len =
- virNodeDeviceListCaps(dev, ret->names.names_val,
- args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virNodeDeviceListCaps(dev, ret->names.names_val,
+ args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -7121,7 +7137,7 @@ remoteDispatchNodeDeviceDettach(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNodeDeviceDettach(dev) == -1) {
+ if (virNodeDeviceDettach(dev) < 0) {
goto cleanup;
}
@@ -7158,7 +7174,7 @@ remoteDispatchNodeDeviceReAttach(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNodeDeviceReAttach(dev) == -1) {
+ if (virNodeDeviceReAttach(dev) < 0) {
goto cleanup;
}
@@ -7195,7 +7211,7 @@ remoteDispatchNodeDeviceReset(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNodeDeviceReset(dev) == -1) {
+ if (virNodeDeviceReset(dev) < 0) {
goto cleanup;
}
@@ -7267,7 +7283,7 @@ remoteDispatchNodeDeviceDestroy(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNodeDeviceDestroy(dev) == -1) {
+ if (virNodeDeviceDestroy(dev) < 0) {
goto cleanup;
}
@@ -7443,7 +7459,7 @@ remoteDispatchDomainEventsDeregister(struct qemud_server *server
ATTRIBUTE_UNUSE
goto cleanup;
}
- if (client->domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LIFECYCLE] == -1) {
+ if (client->domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LIFECYCLE] < 0) {
virNetError(VIR_ERR_INTERNAL_ERROR, _("domain event %d not
registered"), VIR_DOMAIN_EVENT_ID_LIFECYCLE);
goto cleanup;
}
@@ -7543,7 +7559,7 @@ remoteDispatchNumOfSecrets(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfSecrets(conn);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -7565,6 +7581,7 @@ remoteDispatchListSecrets(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_list_secrets_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -7582,11 +7599,12 @@ remoteDispatchListSecrets(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->uuids.uuids_len = virConnectListSecrets(conn, ret->uuids.uuids_val,
- args->maxuuids);
- if (ret->uuids.uuids_len == -1) {
+ len = virConnectListSecrets(conn, ret->uuids.uuids_val,
+ args->maxuuids);
+ if (len < 0) {
goto cleanup;
}
+ ret->uuids.uuids_len = len;
rv = 0;
@@ -8267,7 +8285,7 @@ remoteDispatchDomainGetJobInfo(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainGetJobInfo(dom, &info) == -1) {
+ if (virDomainGetJobInfo(dom, &info) < 0) {
goto cleanup;
}
@@ -8317,7 +8335,7 @@ remoteDispatchDomainAbortJob(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainAbortJob(dom) == -1) {
+ if (virDomainAbortJob(dom) < 0) {
goto cleanup;
}
@@ -8354,7 +8372,7 @@ remoteDispatchDomainMigrateSetMaxDowntime(struct qemud_server
*server ATTRIBUTE_
goto cleanup;
}
- if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) == -1) {
+ if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) < 0) {
goto cleanup;
}
@@ -8390,7 +8408,7 @@ remoteDispatchDomainMigrateSetMaxSpeed(struct qemud_server *server
ATTRIBUTE_UNU
goto cleanup;
}
- if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) == -1) {
+ if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) < 0) {
goto cleanup;
}
@@ -8512,7 +8530,7 @@ remoteDispatchDomainSnapshotNum(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virDomainSnapshotNum(domain, args->flags);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -8537,6 +8555,7 @@ remoteDispatchDomainSnapshotListNames(struct qemud_server *server
ATTRIBUTE_UNUS
{
virDomainPtr domain = NULL;
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -8560,13 +8579,14 @@ remoteDispatchDomainSnapshotListNames(struct qemud_server *server
ATTRIBUTE_UNUS
goto cleanup;
}
- ret->names.names_len = virDomainSnapshotListNames(domain,
- ret->names.names_val,
- args->nameslen,
- args->flags);
- if (ret->names.names_len == -1) {
+ len = virDomainSnapshotListNames(domain,
+ ret->names.names_val,
+ args->nameslen,
+ args->flags);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -8730,7 +8750,7 @@ remoteDispatchDomainRevertToSnapshot(struct qemud_server *server
ATTRIBUTE_UNUSE
if (snapshot == NULL)
goto cleanup;
- if (virDomainRevertToSnapshot(snapshot, args->flags) == -1)
+ if (virDomainRevertToSnapshot(snapshot, args->flags) < 0)
goto cleanup;
rv = 0;
@@ -8771,7 +8791,7 @@ remoteDispatchDomainSnapshotDelete(struct qemud_server *server
ATTRIBUTE_UNUSED,
if (snapshot == NULL)
goto cleanup;
- if (virDomainSnapshotDelete(snapshot, args->flags) == -1)
+ if (virDomainSnapshotDelete(snapshot, args->flags) < 0)
goto cleanup;
rv = 0;
@@ -9004,7 +9024,7 @@ remoteDispatchNwfilterUndefine(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNWFilterUndefine(nwfilter) == -1) {
+ if (virNWFilterUndefine(nwfilter) < 0) {
goto cleanup;
}
@@ -9028,6 +9048,7 @@ remoteDispatchListNwfilters(struct qemud_server *server
ATTRIBUTE_UNUSED,
remote_list_nwfilters_ret *ret)
{
int rv = -1;
+ int len;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
@@ -9046,12 +9067,12 @@ remoteDispatchListNwfilters(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->names.names_len =
- virConnectListNWFilters(conn,
- ret->names.names_val, args->maxnames);
- if (ret->names.names_len == -1) {
+ len = virConnectListNWFilters(conn,
+ ret->names.names_val, args->maxnames);
+ if (len < 0) {
goto cleanup;
}
+ ret->names.names_len = len;
rv = 0;
@@ -9120,7 +9141,7 @@ remoteDispatchNumOfNwfilters(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfNWFilters(conn);
- if (ret->num == -1) {
+ if (ret->num < 0) {
goto cleanup;
}
@@ -9156,7 +9177,7 @@ remoteDispatchDomainGetBlockInfo(struct qemud_server *server
ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainGetBlockInfo(dom, args->path, &info, args->flags) == -1) {
+ if (virDomainGetBlockInfo(dom, args->path, &info, args->flags) < 0) {
goto cleanup;
}
@@ -9197,7 +9218,7 @@ qemuDispatchMonitorCommand(struct qemud_server *server
ATTRIBUTE_UNUSED,
}
if (virDomainQemuMonitorCommand(domain, args->cmd, &ret->result,
- args->flags) == -1) {
+ args->flags) < 0) {
goto cleanup;
}
@@ -9246,7 +9267,7 @@ remoteDispatchDomainOpenConsole(struct qemud_server *server
ATTRIBUTE_UNUSED,
args->devname ? *args->devname : NULL,
stream->st,
args->flags);
- if (r == -1) {
+ if (r < 0) {
goto cleanup;
}
--
1.7.4.2