mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-24 18:30:44 +02:00
n-dhcp4: work around compiler warning in n_dhcp4_socket_packet_send()
With LTO enabled, the compiler might think that "len" is not initialized.
That is even a correct assumption, if the compiler does not understand the
API of sendmsg() and that sendmsg() is supposed to set a negative errno.
Work around by initializing the variable.
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
040c86f15c
commit
4686e9baef
1 changed files with 2 additions and 1 deletions
|
|
@ -348,7 +348,8 @@ static int n_dhcp4_socket_packet_send(int sockfd,
|
|||
.sll_halen = halen,
|
||||
};
|
||||
const void *buf;
|
||||
size_t n_buf, len;
|
||||
size_t n_buf;
|
||||
size_t len = 0;
|
||||
int r;
|
||||
|
||||
c_assert(halen <= sizeof(haddr.sll_addr));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue