mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 00:40:19 +01:00
n-dhcp4: use c_errno() in packet_sendto_udp() to avoid compiler warning
With LTO enabled, the compiler might think that "len" in n_dhcp4_socket_packet_send()
might be uninitialized. That is even a correct assumption, as the compiler does not
understand the API of sendmsg() and that sendmsg() is supposed to set a positive errno.
Work around by using c_errno() in packet_sendto_udp().
shared/n-dhcp4/src/n-dhcp4-c-connection.c: In function n_dhcp4_c_connection_send_request:
shared/n-dhcp4/src/n-dhcp4-socket.c:368:19: error: len may be used uninitialized in this function [-Werror=maybe-uninitialized]
} else if (len != n_buf) {
^
shared/n-dhcp4/src/n-dhcp4-socket.c:351:23: note: len was declared here
size_t n_buf, len;
^
This commit is contained in:
parent
d649a1f9cc
commit
5bdc36b392
1 changed files with 1 additions and 1 deletions
|
|
@ -223,7 +223,7 @@ int packet_sendto_udp(int sockfd,
|
|||
|
||||
pktlen = sendmsg(sockfd, &msg, 0);
|
||||
if (pktlen < 0)
|
||||
return -errno;
|
||||
return -c_errno();
|
||||
|
||||
/*
|
||||
* Kernel never truncates. Worst case, we get -EMSGSIZE. Kernel *might*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue