lib: clear error in clock_snapshots_are_monotonic_one
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 8 Nov 2019 20:04:01 +0000 (15:04 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 11 Nov 2019 17:19:00 +0000 (12:19 -0500)
When bt_clock_snapshot_get_ns_from_origin is called in
clock_snapshots_are_monotonic_one, it can return OVERFLOW_ERROR, in
which case it also sets the current thread error.
clock_snapshots_are_monotonic_one doesn't report an error status to its
caller (it's not its goal), so it should not leave the error there.

This is exercised when running Python test
ClockSnapshotTestCase.test_clock_class.

Change-Id: I0f15c2607c299fabc3a89e6a292d97d8d5815fc4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2360
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/lib/graph/iterator.c

index 121e4bd9a8ed4ca70eb4d6971b83d0d9cd97ea27..40acd76dec671af0546b41db2f5517fce99a0bb1 100644 (file)
@@ -643,8 +643,15 @@ bool clock_snapshots_are_monotonic_one(
                goto end;
        }
 
-       clock_snapshot_status = bt_clock_snapshot_get_ns_from_origin(clock_snapshot, &ns_from_origin);
+       clock_snapshot_status = bt_clock_snapshot_get_ns_from_origin(
+               clock_snapshot, &ns_from_origin);
        if (clock_snapshot_status != BT_FUNC_STATUS_OK) {
+               /*
+                * bt_clock_snapshot_get_ns_from_origin can return
+                * OVERFLOW_ERROR.  We don't really want to report an error to
+                * our caller, so just clear it.
+                */
+               bt_current_thread_clear_error();
                goto end;
        }
 
This page took 0.024895 seconds and 4 git commands to generate.