summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2016-12-08 00:22:05 +0100
committerAlexander Barton <alex@barton.de>2016-12-08 00:22:05 +0100
commit0dc3c134697444e1470c87c6f22211ba220ec4ec (patch)
treeb5eca28478761dcc4ff135f91ec19c065525c87b
parentd0d4de498000ff80d11aaa35509f082a80bb317e (diff)
downloadngircd-0dc3c134697444e1470c87c6f22211ba220ec4ec.tar.gz
ngircd-0dc3c134697444e1470c87c6f22211ba220ec4ec.zip
x-Line synchronization: Don't send negative durations
-rw-r--r--src/ngircd/numeric.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c
index 82e0cf01..380b9078 100644
--- a/src/ngircd/numeric.c
+++ b/src/ngircd/numeric.c
@@ -176,6 +176,7 @@ Synchronize_Lists(CLIENT * Client)
 	CHANNEL *c;
 	struct list_head *head;
 	struct list_elem *elem;
+	time_t t;
 
 	assert(Client != NULL);
 
@@ -183,9 +184,10 @@ Synchronize_Lists(CLIENT * Client)
 	head = Class_GetList(CLASS_GLINE);
 	elem = Lists_GetFirst(head);
 	while (elem) {
+		t = Lists_GetValidity(elem) - time(NULL);
 		if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s",
 					Lists_GetMask(elem),
-					(long)(Lists_GetValidity(elem) - time(NULL)),
+					t > 0 ? (long)t : 0,
 					Lists_GetReason(elem)))
 			return DISCONNECTED;
 		elem = Lists_GetNext(elem);