From bd50b697294fafcbb3d06d269871707a9186858b Mon Sep 17 00:00:00 2001 From: Thomas Habets Date: Sun, 31 Dec 2023 14:22:45 +0000 Subject: [PATCH] Fix warning in test --- src/arping_test.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/arping_test.c b/src/arping_test.c index 707e25b..236fdf0 100644 --- a/src/arping_test.c +++ b/src/arping_test.c @@ -79,10 +79,8 @@ read_main(void* p) char *cur = out->buffer; for (;;) { - ssize_t n; - n = out->bufsize - (cur - out->buffer); - assert(n > 0); - n = read(out->reader_fd, cur, n); + const size_t to_read = out->bufsize - (size_t)(cur - out->buffer); + const ssize_t n = read(out->reader_fd, cur, to_read); if (n > 0) { cur += n; }