From: Yannick Brosseau Date: Thu, 15 Nov 2012 22:06:33 +0000 (-0500) Subject: Fix: Report success even if we find at least one valid stream in find_max_timestamp_c... X-Git-Tag: v1.0.1~10 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=38380786954798ace38594b1e92905aeba4da55d;hp=08ac0e0801251211279f9deb07f9cbbbd712d9c5 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 --- 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; }