fix below zero message count check

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.
pull/32/head
Stefan Agner 2020-05-18 01:47:11 +02:00 committed by Andri Yngvason
parent a37eed4a4a
commit 8f9c71bb33
1 changed files with 1 additions and 1 deletions

View File

@ -120,7 +120,7 @@ static int stream__flush_plain(struct stream* self)
break; break;
} }
if (n_msgs < 0) if (n_msgs == 0)
return 0; return 0;
bytes_sent = writev(self->fd, iov, n_msgs); bytes_sent = writev(self->fd, iov, n_msgs);