summaryrefslogtreecommitdiff
path: root/src/peers.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2025-06-19 17:33:09 +0200
committerJesper Jensen <jesper@jnsn.dev>2025-06-19 17:33:09 +0200
commitc1be1fdaa93fb0c492047f2f57c238e8d42b50eb (patch)
tree898467f363938f4b1e08d743430c65d68f6ed634 /src/peers.c
parent47091526d2526e243b0322a5652d01e588ef1475 (diff)
Correct duplicate check
I though it was a cool feature that C allowed you to implicitly memcmp statically sized arrays. It turns out it doesn't, it was just comparing their pointers which are obviously not equal.
Diffstat (limited to 'src/peers.c')
-rw-r--r--src/peers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/peers.c b/src/peers.c
index 42722b4..5942021 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -53,7 +53,7 @@ static void check_duplicates() {
qsort(keys, keyi, sizeof(struct infohash), infohash_compar);
for(size_t i = 1; i < keyi; i++) {
- if(keys[i].inner == keys[i-1].inner) {
+ if(memcmp(&keys[i], &keys[i-1], sizeof(struct infohash)) == 0) {
fatal("Duplicate key found");
}
}