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.
This commit is contained in:
Rodrigo Arias 2023-03-24 12:55:39 +01:00 committed by Rodrigo Arias Mallo
parent 3d8e2000fd
commit 34a823f36d

View File

@ -320,6 +320,7 @@ stream_check(struct stream *stream)
struct ovni_ev *ev = stream_ev(stream); struct ovni_ev *ev = stream_ev(stream);
uint64_t last_clock = ev->header.clock; uint64_t last_clock = ev->header.clock;
int backjump = 0;
while ((ret = stream_step(stream)) == 0) { while ((ret = stream_step(stream)) == 0) {
ev = stream_ev(stream); ev = stream_ev(stream);
@ -328,7 +329,7 @@ stream_check(struct stream *stream)
if (cur_clock < last_clock) { if (cur_clock < last_clock) {
err("backwards jump in time %ld -> %ld for stream %s", err("backwards jump in time %ld -> %ld for stream %s",
last_clock, cur_clock, stream->relpath); last_clock, cur_clock, stream->relpath);
ret = -1; backjump = 1;
} }
last_clock = cur_clock; last_clock = cur_clock;
@ -339,7 +340,10 @@ stream_check(struct stream *stream)
return -1; return -1;
} }
return ret; if (backjump)
return -1;
return 0;
} }
static int static int