diff options
Diffstat (limited to 'ot_sync.c')
| -rw-r--r-- | ot_sync.c | 10 |
1 files changed, 4 insertions, 6 deletions
| @@ -7,12 +7,10 @@ | |||
| 7 | #include <pthread.h> | 7 | #include <pthread.h> |
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | #include <string.h> | 9 | #include <string.h> |
| 10 | #include <sys/mman.h> | ||
| 11 | #include <sys/types.h> | 10 | #include <sys/types.h> |
| 12 | #include <sys/uio.h> | 11 | #include <sys/uio.h> |
| 13 | 12 | ||
| 14 | /* Libowfat */ | 13 | /* Libowfat */ |
| 15 | #include "byte.h" | ||
| 16 | #include "io.h" | 14 | #include "io.h" |
| 17 | #include "scan.h" | 15 | #include "scan.h" |
| 18 | 16 | ||
| @@ -36,15 +34,15 @@ int add_changeset_to_tracker(uint8_t *data, size_t len) { | |||
| 36 | uint8_t *end = data + len; | 34 | uint8_t *end = data + len; |
| 37 | unsigned long peer_count; | 35 | unsigned long peer_count; |
| 38 | 36 | ||
| 39 | /* We do know, that the string is \n terminated, so it cant | 37 | /* We do know, that the string is \n terminated, so it can't |
| 40 | overflow */ | 38 | overflow */ |
| 41 | if (byte_diff(data, 8, "d4:syncd")) | 39 | if (!memcmp(data, "d4:syncd", 8)) |
| 42 | return -1; | 40 | return -1; |
| 43 | data += 8; | 41 | data += 8; |
| 44 | 42 | ||
| 45 | while (1) { | 43 | while (1) { |
| 46 | if (byte_diff(data, 3, "20:")) { | 44 | if (!memcmp(data, "20:", 3)) { |
| 47 | if (byte_diff(data, 2, "ee")) | 45 | if (!memcmp(data, "ee", 2)) |
| 48 | return -1; | 46 | return -1; |
| 49 | return 0; | 47 | return 0; |
| 50 | } | 48 | } |
