From: Vincent Bernat Date: Tue, 20 Oct 2015 16:38:05 +0000 (+0200) Subject: event: check if timer is present before trying to activate it X-Git-Tag: 0.8.0~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=126970da3a89f2b313d3d49b0bd63396b7162ca0;p=thirdparty%2Flldpd.git event: check if timer is present before trying to activate it A timer should always be present, but some previous error conditions may make it absent. Don't just crash in this condition. See #135. --- diff --git a/src/daemon/event.c b/src/daemon/event.c index 65b4be9c..14d92055 100644 --- a/src/daemon/event.c +++ b/src/daemon/event.c @@ -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