tFix sha512_compare() to use a referent peer - synk - synchronize files between hosts
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit e88965f27c0b666e672353ad1a79558fe0f86f6b
(DIR) parent b59800dbb6e6361dfe8e2597b3585450d8763509
(HTM) Author: Willy <willyatmailoodotorg>
Date: Fri, 2 Sep 2016 01:07:48 +0200
Fix sha512_compare() to use a referent peer
Diffstat:
M synk.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
---
(DIR) diff --git a/synk.c b/synk.c
t@@ -332,16 +332,12 @@ flushpeers(struct peers_t *plist)
int
uptodate(struct peers_t *plist)
{
- struct peer_t *tmp = NULL;
- unsigned char *hash = NULL;
+ struct peer_t *tmp, *ref;
+ ref = SLIST_FIRST(plist);
SLIST_FOREACH(tmp, plist, entries) {
- if (hash == NULL) {
- hash = tmp->meta.hash;
- } else {
- if (!sha512_compare(hash, tmp->meta.hash))
- return 0;
- }
+ if (!sha512_compare(ref->meta.hash, tmp->meta.hash))
+ return 0;
}
return 1;