1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

remote: Handle xdr char ** data return fields more consistently

For consistency, handle the @data "char **" (or remote_string)
assignments and processing similarly between various APIs

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
John Ferlan 2018-12-17 07:40:36 -05:00
parent eb448cb5c0
commit 4d95d35637

View File

@ -1366,7 +1366,6 @@ remoteRelayDomainEventMetadataChange(virConnectPtr conn,
{ {
daemonClientEventCallbackPtr callback = opaque; daemonClientEventCallbackPtr callback = opaque;
remote_domain_event_callback_metadata_change_msg data; remote_domain_event_callback_metadata_change_msg data;
char **nsurip;
if (callback->callbackID < 0 || if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom)) !remoteRelayDomainEventCheckACL(callback->client, conn, dom))
@ -1380,13 +1379,9 @@ remoteRelayDomainEventMetadataChange(virConnectPtr conn,
data.type = type; data.type = type;
if (nsuri) { if (nsuri) {
if (VIR_ALLOC(nsurip) < 0) if (VIR_ALLOC(data.nsuri) < 0 ||
return -1; VIR_STRDUP(*(data.nsuri), nsuri) < 0)
if (VIR_STRDUP(*nsurip, nsuri) < 0) { goto error;
VIR_FREE(nsurip);
return -1;
}
data.nsuri = nsurip;
} }
if (make_nonnull_domain(&data.dom, dom) < 0) if (make_nonnull_domain(&data.dom, dom) < 0)
@ -1432,9 +1427,8 @@ remoteRelayDomainEventBlockThreshold(virConnectPtr conn,
if (VIR_STRDUP(data.dev, dev) < 0) if (VIR_STRDUP(data.dev, dev) < 0)
goto error; goto error;
if (path) { if (path) {
if (VIR_ALLOC(data.path) < 0) if (VIR_ALLOC(data.path) < 0 ||
goto error; VIR_STRDUP(*(data.path), path) < 0)
if (VIR_STRDUP(*(data.path), path) < 0)
goto error; goto error;
} }
data.threshold = threshold; data.threshold = threshold;
@ -4006,14 +4000,9 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr server ATTRIBUTE_UNUSED,
ret->parentName = NULL; ret->parentName = NULL;
} else { } else {
/* remoteDispatchClientRequest will free this. */ /* remoteDispatchClientRequest will free this. */
char **parent_p; if (VIR_ALLOC(ret->parentName) < 0 ||
if (VIR_ALLOC(parent_p) < 0) VIR_STRDUP(*(ret->parentName), parent) < 0)
goto cleanup; goto cleanup;
if (VIR_STRDUP(*parent_p, parent) < 0) {
VIR_FREE(parent_p);
goto cleanup;
}
ret->parentName = parent_p;
} }
rv = 0; rv = 0;