Fix: Report success even if we find at least one valid stream in find_max_timestamp_c...
authorYannick Brosseau <yannick.brosseau@gmail.com>
Thu, 15 Nov 2012 22:06:33 +0000 (17:06 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 15 Nov 2012 22:06:33 +0000 (17:06 -0500)
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 <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/iterator.c

index c50b0ef36c18085496b0933832b9dd3df5ec3044..b205a93764ddc1940db73a35365977a586314b7b 100644 (file)
@@ -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;
 }
 
This page took 0.024939 seconds and 4 git commands to generate.