From d747e85f873b9938b3ac6cb8fdec5e292eb3a051 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 8 Nov 2019 15:04:01 -0500 Subject: [PATCH] lib: clear error in clock_snapshots_are_monotonic_one 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 Reviewed-on: https://review.lttng.org/c/babeltrace/+/2360 Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/lib/graph/iterator.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index 121e4bd9..40acd76d 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -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; } -- 2.34.1