chiark / gitweb /
networkd: add assert
authorTom Gundersen <teg@jklm.no>
Sat, 14 Jun 2014 13:03:56 +0000 (15:03 +0200)
committerTom Gundersen <teg@jklm.no>
Sat, 14 Jun 2014 13:06:17 +0000 (15:06 +0200)
It should not be possible to have a DHCP lease on a link without also having
an associated network. Add assert() to avoid compiler warnings.

Reported by Thomas H. P. Andersen

src/network/networkd-link.c

index baa0756e6fc3791148a36c215b6ce6bfa9e9152b..452fcd43c2203fa0c6cb7f4eafeefa245eed68e1 100644 (file)
@@ -2152,6 +2152,8 @@ int link_save(Link *link) {
         }
 
         if (link->dhcp_lease) {
+                assert(link->network);
+
                 r = dhcp_lease_save(link->dhcp_lease, link->lease_file);
                 if (r < 0)
                         goto finish;