mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virnetmessage: Introduce virNetMessageClearFDs
The helper splits out the clearing of the FDs transacted inside a virNetMessage. APIs transacting FDs both from and to the client at the same time will need to clear the FDs stored in virNetMessage as the structure is re-used for the reply and without clearing the list of FDs we'd return the FDs sent by the client in addition to the new FDs sent by the API.t Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3c4b49e871
commit
7cfbfe66fc
@ -102,6 +102,7 @@ virNetDaemonUpdateServices;
|
||||
# rpc/virnetmessage.h
|
||||
virNetMessageAddFD;
|
||||
virNetMessageClear;
|
||||
virNetMessageClearFDs;
|
||||
virNetMessageClearPayload;
|
||||
virNetMessageDecodeHeader;
|
||||
virNetMessageDecodeLength;
|
||||
|
@ -48,7 +48,7 @@ virNetMessage *virNetMessageNew(bool tracked)
|
||||
|
||||
|
||||
void
|
||||
virNetMessageClearPayload(virNetMessage *msg)
|
||||
virNetMessageClearFDs(virNetMessage *msg)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@ -58,6 +58,13 @@ virNetMessageClearPayload(virNetMessage *msg)
|
||||
msg->donefds = 0;
|
||||
msg->nfds = 0;
|
||||
VIR_FREE(msg->fds);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virNetMessageClearPayload(virNetMessage *msg)
|
||||
{
|
||||
virNetMessageClearFDs(msg);
|
||||
|
||||
msg->bufferOffset = 0;
|
||||
msg->bufferLength = 0;
|
||||
|
@ -49,6 +49,7 @@ struct _virNetMessage {
|
||||
|
||||
virNetMessage *virNetMessageNew(bool tracked);
|
||||
|
||||
void virNetMessageClearFDs(virNetMessage *msg);
|
||||
void virNetMessageClearPayload(virNetMessage *msg);
|
||||
|
||||
void virNetMessageClear(virNetMessage *);
|
||||
|
Loading…
Reference in New Issue
Block a user