From 8f9c71bb3386a5c7e670a25e5dedfa1189ee2f64 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 18 May 2020 01:47:11 +0200 Subject: [PATCH] fix below zero message count check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit size_t is unsigned and hence can't be below zero, triggering this gcc warning with gcc 10: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits] It seems this if statement is meant to check if there are messages to process (larger than 0). If there are no messages, we should jump out early. --- src/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stream.c b/src/stream.c index d425836..6916cad 100644 --- a/src/stream.c +++ b/src/stream.c @@ -120,7 +120,7 @@ static int stream__flush_plain(struct stream* self) break; } - if (n_msgs < 0) + if (n_msgs == 0) return 0; bytes_sent = writev(self->fd, iov, n_msgs);