git » nmdb » commit 4470a6e

Delete all events properly on shutdown.

author Alberto Bertogli
2007-08-09 07:37:17 UTC
committer Alberto Bertogli
2007-08-09 07:37:17 UTC
parent b450b7cb0fccf5fb04d2bfd9b9019004797577a0

Delete all events properly on shutdown.

This fixes a bug reported by Arnaud Connois <arnaud@connois.com> that
caused a libevent assertion to raise on event_del().

That was because we were deleting tipc_evt, but it may not be initialized
properly if ENABLE_TIPC=0.

It triggered on Fedora Core 5 installs but not on Fedora 7 or Gentoo,
probably because of some differences in the build environment.

Thanks to Arnaud Connois for all the assistance tracking this down.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

nmdb/net.c +7 -2

diff --git a/nmdb/net.c b/nmdb/net.c
index e4772ea..1145705 100644
--- a/nmdb/net.c
+++ b/nmdb/net.c
@@ -87,8 +87,13 @@ void net_loop(void)
 
 	event_dispatch();
 
-	event_del(&tipc_evt);
-	event_del(&tcp_evt);
+	if (ENABLE_TIPC)
+		event_del(&tipc_evt);
+	if (ENABLE_TCP)
+		event_del(&tcp_evt);
+	if (ENABLE_UDP)
+		event_del(&udp_evt);
+
 	signal_del(&sigterm_evt);
 	signal_del(&sigint_evt);
 	signal_del(&sigusr2_evt);