From 34a823f36daee0256e1d9883cea3ccfec18f2354 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 24 Mar 2023 12:55:39 +0100 Subject: [PATCH] Fix ovnisort check operation The stream_step() function will return 1 when reaching the end of the stream, making the check return non-zero in each stream, even if all the events have a monotonically increasing clock. --- src/emu/ovnisort.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/emu/ovnisort.c b/src/emu/ovnisort.c index 39af870..3aa6d22 100644 --- a/src/emu/ovnisort.c +++ b/src/emu/ovnisort.c @@ -320,6 +320,7 @@ stream_check(struct stream *stream) struct ovni_ev *ev = stream_ev(stream); uint64_t last_clock = ev->header.clock; + int backjump = 0; while ((ret = stream_step(stream)) == 0) { ev = stream_ev(stream); @@ -328,7 +329,7 @@ stream_check(struct stream *stream) if (cur_clock < last_clock) { err("backwards jump in time %ld -> %ld for stream %s", last_clock, cur_clock, stream->relpath); - ret = -1; + backjump = 1; } last_clock = cur_clock; @@ -339,7 +340,10 @@ stream_check(struct stream *stream) return -1; } - return ret; + if (backjump) + return -1; + + return 0; } static int