summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-01-19 14:50:58 +0100
committerThomas Haller <thaller@redhat.com>2021-01-19 19:53:37 +0100
commit5bdc36b392fe10057244a57819eb9cf6bed72ebd (patch)
treea26e88fab9a23c35b80061c739d6b604fd64076f
parentd649a1f9cc630e4d2769c592f9b54e60fbca3dc2 (diff)
downloadNetworkManager-5bdc36b392fe10057244a57819eb9cf6bed72ebd.tar.gz
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; ^
-rw-r--r--shared/n-dhcp4/src/util/packet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shared/n-dhcp4/src/util/packet.c b/shared/n-dhcp4/src/util/packet.c
index ef18b0b464..48f2c85eb9 100644
--- a/shared/n-dhcp4/src/util/packet.c
+++ b/shared/n-dhcp4/src/util/packet.c
@@ -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*