diff options
-rw-r--r-- | src/rpc/virnetclient.c | 3 | ||||
-rw-r--r-- | src/rpc/virnetmessage.c | 12 | ||||
-rw-r--r-- | src/rpc/virnetserverclient.c | 3 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 95cd9a6c7e..eb46e34301 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1428,8 +1428,7 @@ virNetClientIOHandleInput(virNetClientPtr client) if (client->msg.header.type == VIR_NET_REPLY_WITH_FDS) { size_t i; - if (client->msg.nfds == 0 && - virNetMessageDecodeNumFDs(&client->msg) < 0) + if (virNetMessageDecodeNumFDs(&client->msg) < 0) return -1; for (i = client->msg.donefds; i < client->msg.nfds; i++) { diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c index 5908b074a8..94c4c89e4f 100644 --- a/src/rpc/virnetmessage.c +++ b/src/rpc/virnetmessage.c @@ -327,11 +327,13 @@ int virNetMessageDecodeNumFDs(virNetMessagePtr msg) goto cleanup; } - msg->nfds = numFDs; - if (VIR_ALLOC_N(msg->fds, msg->nfds) < 0) - goto cleanup; - for (i = 0; i < msg->nfds; i++) - msg->fds[i] = -1; + if (msg->nfds == 0) { + msg->nfds = numFDs; + if (VIR_ALLOC_N(msg->fds, msg->nfds) < 0) + goto cleanup; + for (i = 0; i < msg->nfds; i++) + msg->fds[i] = -1; + } VIR_DEBUG("Got %zu FDs from peer", msg->nfds); diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index fa4e5daabb..6e086b7b4e 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -1189,8 +1189,7 @@ static void virNetServerClientDispatchRead(virNetServerClientPtr client) /* Now figure out if we need to read more data to get some * file descriptors */ if (msg->header.type == VIR_NET_CALL_WITH_FDS) { - if (msg->nfds == 0 && - virNetMessageDecodeNumFDs(msg) < 0) { + if (virNetMessageDecodeNumFDs(msg) < 0) { virNetMessageQueueServe(&client->rx); virNetMessageFree(msg); client->wantClose = true; |