dhcp-client: port to recvmsg_safe()

Split out of #15457, let's see if this is the culprit of the CI failure.

(also setting green label here, since @keszybz already greenlit it in that other PR)
This commit is contained in:
Lennart Poettering 2020-04-23 19:57:53 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent a8af7f6a5c
commit 84b5d3e532
1 changed files with 7 additions and 7 deletions

View File

@ -1927,14 +1927,14 @@ static int client_receive_message_raw(
iov = IOVEC_MAKE(packet, buflen);
len = recvmsg(fd, &msg, 0);
if (len < 0) {
if (IN_SET(errno, EAGAIN, EINTR, ENETDOWN))
return 0;
return log_dhcp_client_errno(client, errno,
len = recvmsg_safe(fd, &msg, 0);
if (IN_SET(len, -EAGAIN, -EINTR, -ENETDOWN))
return 0;
if (len < 0)
return log_dhcp_client_errno(client, len,
"Could not receive message from raw socket: %m");
} else if ((size_t)len < sizeof(DHCPPacket))
if ((size_t) len < sizeof(DHCPPacket))
return 0;
CMSG_FOREACH(cmsg, &msg)