From 38380786954798ace38594b1e92905aeba4da55d Mon Sep 17 00:00:00 2001 From: Yannick Brosseau Date: Thu, 15 Nov 2012 17:06:33 -0500 Subject: [PATCH] Fix: Report success even if we find at least one valid stream in find_max_timestamp_ctf_stream_class Fix the case were the last stream is completely empty and return EOF. This return value was returned even if other streams were valid Signed-off-by: Yannick Brosseau Signed-off-by: Mathieu Desnoyers --- lib/iterator.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/iterator.c b/lib/iterator.c index c50b0ef3..b205a937 100644 --- a/lib/iterator.c +++ b/lib/iterator.c @@ -253,7 +253,7 @@ static int find_max_timestamp_ctf_stream_class( struct ctf_file_stream **cfsp, uint64_t *max_timestamp) { - int ret = EOF, i; + int ret = EOF, i, found = 0; for (i = 0; i < stream_class->streams->len; i++) { struct ctf_stream_definition *stream; @@ -272,9 +272,13 @@ static int find_max_timestamp_ctf_stream_class( if (current_max_ts >= *max_timestamp) { *max_timestamp = current_max_ts; *cfsp = cfs; + found = 1; } } assert(ret >= 0 || ret == EOF); + if (found) { + return 0; + } return ret; } -- 2.34.1