dhcp: workaround "maybe-uninitialized" in dhcp_event_cb()

With LTO we get a compiler warning:

    src/dhcp/nm-dhcp-systemd.c: In function dhcp_event_cb:
    src/dhcp/nm-dhcp-systemd.c:554: error: lease may be used uninitialized in this function [-Werror=maybe-uninitialized]
      554 |   r = sd_dhcp_lease_get_server_identifier (lease, &addr);
          |
    src/dhcp/nm-dhcp-systemd.c:528: note: lease was declared here
      528 |  sd_dhcp_lease *lease;
          |

Fixes: 7f217d0345 ('core: honor the ipv4.dhcp-reject-servers property')
This commit is contained in:
Thomas Haller 2020-08-28 14:28:07 +02:00
parent 12e8557476
commit a75dfc73e2
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -525,7 +525,7 @@ dhcp_event_cb (sd_dhcp_client *client, int event, gpointer user_data)
NMDhcpSystemd *self = NM_DHCP_SYSTEMD (user_data);
NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
char addr_str[INET_ADDRSTRLEN];
sd_dhcp_lease *lease;
sd_dhcp_lease *lease = NULL;
struct in_addr addr;
int r;