From: Mathieu Desnoyers Date: Tue, 17 May 2016 16:06:45 +0000 (-0400) Subject: Fix: unchecked return value in trace_clock_read64_monotonic X-Git-Tag: v2.8.0~38 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7e131d3eb830ee99901df00246604a117868f726;p=lttng-tools.git Fix: unchecked return value in trace_clock_read64_monotonic Found by Coverity: CID 1311498 (#1 of 1): Unchecked return value (CHECKED_RETURN)1. check_return: Calling clock_gettime without checking return value (as is done elsewhere 8 out of 9 times). Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/ust-clock.h b/src/bin/lttng-sessiond/ust-clock.h index 849373763..c2e0cbcc3 100644 --- a/src/bin/lttng-sessiond/ust-clock.h +++ b/src/bin/lttng-sessiond/ust-clock.h @@ -57,7 +57,12 @@ uint64_t trace_clock_read64_monotonic(void) { struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); + if (clock_gettime(CLOCK_MONOTONIC, &ts)) { + /* TODO Report error cleanly up the chain. */ + PERROR("clock_gettime CLOCK_MONOTONIC"); + ts.tv_sec = 0; + ts.tv_nsec = 0; + } return ((uint64_t) ts.tv_sec * 1000000000ULL) + ts.tv_nsec; }