]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
event: check if timer is present before trying to activate it
authorVincent Bernat <vincent@bernat.im>
Tue, 20 Oct 2015 16:38:05 +0000 (18:38 +0200)
committerVincent Bernat <vincent@bernat.im>
Tue, 20 Oct 2015 16:40:41 +0000 (18:40 +0200)
A timer should always be present, but some previous error conditions may
make it absent. Don't just crash in this condition. See #135.

src/daemon/event.c

index 65b4be9cb98ce225ad85f3c72b6330aa48a34fdf..14d9205565cf72a935bc78f85ac71ce951bd63e7 100644 (file)
@@ -483,8 +483,13 @@ void
 levent_send_now(struct lldpd *cfg)
 {
        struct lldpd_hardware *hardware;
-       TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries)
-               event_active(hardware->h_timer, EV_TIMEOUT, 1);
+       TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries) {
+               if (hardware->h_timer)
+                       event_active(hardware->h_timer, EV_TIMEOUT, 1);
+               else
+                       log_warnx("event", "BUG: no timer present for interface %s",
+                           hardware->h_ifname);
+       }
 }
 
 static void