
On 04/13/2011 12:13 PM, Daniel P. Berrange wrote:
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(-)
Why the change in lines?
@@ -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;
Oh, I see. You didn't want to change ret until you know the value is valid. ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org