ANDROID: lib/vdso: do not update timespec if clock_getres() fails

In __cvdso_clock_getres_time32(), when clock_getres_fallback()
fails, it's not required to update the struct timespec res.

Signed-off-by: Chiawei Wang <chiaweiwang@google.com>
Reviewed-by: Mark Salyzyn <salyzyn@google.com>
Bug: 159086668
Bug: 154668398
Test: run cts -m CtsBionicTestCases -t time#clock_getres_unknown
Change-Id: Ibb7279d4520658d5c8be76e721249d3c62267d9f
This commit is contained in:
Chiawei Wang 2020-06-16 23:47:08 +08:00 committed by Alistair Delva
parent 4da740c10d
commit 4f2c5aef95

View File

@ -232,8 +232,11 @@ __cvdso_clock_getres_time32(clockid_t clock, struct old_timespec32 *res)
if (unlikely(ret))
return clock_getres32_fallback(clock, res);
#else
if (unlikely(ret))
if (unlikely(ret)) {
ret = clock_getres_fallback(clock, &ts);
if (unlikely(ret))
return ret;
}
#endif
if (likely(res)) {