From 649547f241317bf5e07ed2045cf250f1e45f219e Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Fri, 29 Sep 2017 16:07:52 -0400 Subject: [PATCH] fix: compare position safely even in case of overflow Signed-off-by: Julien Desfossez --- src/common/consumer/consumer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index 344a72eab..2bfcef37a 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -4179,7 +4179,7 @@ int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream) fprintf(stderr, "packet %lu, pos %lu\n", stream->key, consumed_pos); /* Rotate position not reached yet. */ - if (consumed_pos < stream->rotate_position) { + if ((long) (consumed_pos - stream->rotate_position) < 0) { ret = 0; goto end; } -- 2.34.1