summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-06-30 15:58:44 +0200
committerThomas Haller <thaller@redhat.com>2021-06-30 17:14:30 +0200
commit7adbda7348f8cec071b7ba647329160a29a45df0 (patch)
tree403923a814586d56df32671a55d8d285d766d8e2
parent9541b0bea4082b25bdc11c7cfa0087d549e5ceeb (diff)
downloadNetworkManager-7adbda7348f8cec071b7ba647329160a29a45df0.tar.gz
n-dhcp4: avoid maybe-uninitialized warning in n_dhcp4_c_connection_dispatch_io()
On RHEL-8.5, s390x with gcc-8.5.0-2.el8, we get a compiler warning: $ CFLAGS='-O2 -Werror=maybe-uninitialized' meson build ... cc -Isrc/libndhcp4-private.a.p -Isrc -I../src -Isubprojects/c-list/src -I../subprojects/c-list/src -Isubprojects/c-siphash/src -I../subprojects/c-siphash/src -Isubprojects/c-stdaux/src -I../subprojects/c-stdaux/src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -g -D_GNU_SOURCE -O2 -Werror=maybe-uninitialized -fPIC -fvisibility=hidden -fno-common -MD -MQ src/libndhcp4-private.a.p/n-dhcp4-c-connection.c.o -MF src/libndhcp4-private.a.p/n-dhcp4-c-connection.c.o.d -o src/libndhcp4-private.a.p/n-dhcp4-c-connection.c.o -c ../src/n-dhcp4-c-connection.c ../src/n-dhcp4-c-connection.c: In function ‘n_dhcp4_c_connection_dispatch_io’: ../src/n-dhcp4-c-connection.c:1151:17: error: ‘type’ may be used uninitialized in this function [-Werror=maybe-uninitialized] uint8_t type; ^~~~ https://github.com/nettools/n-dhcp4/pull/24 (cherry picked from commit 3a4822c52c8893e56b1506d771a1441497c8209a)
-rw-r--r--src/n-dhcp4/src/n-dhcp4-c-connection.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/n-dhcp4/src/n-dhcp4-c-connection.c b/src/n-dhcp4/src/n-dhcp4-c-connection.c
index 3123525390..4aba97393d 100644
--- a/src/n-dhcp4/src/n-dhcp4-c-connection.c
+++ b/src/n-dhcp4/src/n-dhcp4-c-connection.c
@@ -1148,7 +1148,7 @@ int n_dhcp4_c_connection_dispatch_io(NDhcp4CConnection *connection,
_c_cleanup_(n_dhcp4_incoming_freep) NDhcp4Incoming *message = NULL;
char serv_addr[INET_ADDRSTRLEN];
char client_addr[INET_ADDRSTRLEN];
- uint8_t type;
+ uint8_t type = 0;
int r;
switch (connection->state) {