Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
use proper flags for sendmsg() on Unix (#32356)
Browse files Browse the repository at this point in the history
* use proper flags

* fix spacing
  • Loading branch information
wfurt authored Sep 20, 2018
1 parent 601dd47 commit 991edc8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Native/Unix/System.Native/pal_networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ static void ConvertMessageHeaderToMsghdr(struct msghdr* header, const MessageHea
header->msg_iovlen = (__typeof__(header->msg_iovlen))iovlen;
header->msg_control = messageHeader->ControlBuffer;
header->msg_controllen = (uint32_t)messageHeader->ControlBufferLen;
header->msg_flags = 0;
}

int32_t SystemNative_GetControlMessageBufferSize(int32_t isIPv4, int32_t isIPv6)
Expand Down Expand Up @@ -1230,7 +1231,7 @@ int32_t SystemNative_ReceiveMessage(intptr_t socket, MessageHeader* messageHeade

assert((int32_t)header.msg_namelen <= messageHeader->SocketAddressLen);
messageHeader->SocketAddressLen = Min((int32_t)header.msg_namelen, messageHeader->SocketAddressLen);

assert(header.msg_controllen <= (size_t)messageHeader->ControlBufferLen);
messageHeader->ControlBufferLen = Min((int32_t)header.msg_controllen, messageHeader->ControlBufferLen);

Expand Down Expand Up @@ -1266,7 +1267,7 @@ int32_t SystemNative_SendMessage(intptr_t socket, MessageHeader* messageHeader,
ConvertMessageHeaderToMsghdr(&header, messageHeader, fd);

ssize_t res;
while ((res = sendmsg(fd, &header, flags)) < 0 && errno == EINTR);
while ((res = sendmsg(fd, &header, socketFlags)) < 0 && errno == EINTR);
if (res != -1)
{
*sent = res;
Expand Down

0 comments on commit 991edc8

Please sign in to comment.