From 396cd99e3bc51bbc23387259da028d109349374c Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sat, 29 Jul 2017 17:28:46 +0200 Subject: ipcpd: Fix registration bug in DHT --- src/ipcpd/normal/dht.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ipcpd/normal') diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c index 9072ee5a..74618658 100644 --- a/src/ipcpd/normal/dht.c +++ b/src/ipcpd/normal/dht.c @@ -1357,7 +1357,7 @@ static int kad_add(struct dht * dht, pthread_rwlock_wrlock(&dht->lock); - while (--n >= 0) { + while (n-- > 0) { if (contacts[n].id.len != dht->b) log_warn("Bad key length in contact data."); @@ -1557,7 +1557,7 @@ static void kad_publish(struct dht * dht, n = lookup_contact_addrs(lu, addrs); - while (--n > 0) { + while (n-- > 0) { if (addrs[n] == dht->addr) { kad_contact_msg_t msg = KAD_CONTACT_MSG__INIT; msg.id.data = (uint8_t *) key; -- cgit v1.2.3