提交 4d95d356 编写于 作者: J John Ferlan

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: NJohn Ferlan <jferlan@redhat.com>
ACKed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 eb448cb5
...@@ -1366,7 +1366,6 @@ remoteRelayDomainEventMetadataChange(virConnectPtr conn, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册