From: Scott Lamb <slamb@slamb.org>
Date: Wed, 7 Nov 2007 02:48:15 +0000 (+0000)
Subject: Fix reload crash
X-Git-Tag: import-tinc-1.1~616
X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=b0b52991849073de059a188800d1b2f03663a188;p=meshlink

Fix reload crash

sighup_handler was expecting the connection_tree to stay the same across
terminate_connection(), which hasn't been true since r1539.
---

diff --git a/src/net.c b/src/net.c
index 1b5bb166..a4bff6d9 100644
--- a/src/net.c
+++ b/src/net.c
@@ -272,7 +272,7 @@ static void sigwinch_handler(int signal, short events, void *data) {
 
 static void sighup_handler(int signal, short events, void *data) {
 	connection_t *c;
-	splay_node_t *node;
+	splay_node_t *node, *next;
 	char *fname;
 	struct stat s;
 	static time_t last_config_check = 0;
@@ -292,8 +292,9 @@ static void sighup_handler(int signal, short events, void *data) {
 
 	/* Close connections to hosts that have a changed or deleted host config file */
 	
-	for(node = connection_tree->head; node; node = node->next) {
+	for(node = connection_tree->head; node; node = next) {
 		c = node->data;
+		next = node->next;
 		
 		if(c->outgoing) {
 			free(c->outgoing->name);