summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@redhat.com>2014-11-18 09:42:41 -0500
committerDan Winship <danw@redhat.com>2014-11-19 12:03:03 -0500
commit7bf7ebc47074269c4817a91f668f8a2805e36f99 (patch)
treed2c98829870fc9d631f83e4f1eca72c00046c6b1
parent71b676590c47abcfcfc546565b5da2312931c880 (diff)
downloadNetworkManager-7bf7ebc47074269c4817a91f668f8a2805e36f99.tar.gz
dhcp: fix startup warnings with dhcp=internal
If asked to read a file that doesn't exist, sd_dhcp_lease_load() returns 0 (success) without setting the out lease argument. So we need to check both the return status and the lease before proceeding.
-rw-r--r--src/dhcp-manager/nm-dhcp-systemd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dhcp-manager/nm-dhcp-systemd.c b/src/dhcp-manager/nm-dhcp-systemd.c
index 9cdd9e206b..52f782c946 100644
--- a/src/dhcp-manager/nm-dhcp-systemd.c
+++ b/src/dhcp-manager/nm-dhcp-systemd.c
@@ -390,7 +390,7 @@ nm_dhcp_systemd_get_lease_ip_configs (const char *iface,
path = get_leasefile_path (iface, uuid, FALSE);
r = sd_dhcp_lease_load (&lease, path);
- if (r == 0) {
+ if (r == 0 && lease) {
ip4_config = lease_to_ip4_config (lease, NULL, 0, FALSE, NULL);
if (ip4_config)
leases = g_slist_append (leases, ip4_config);