From: Mathieu Desnoyers Date: Mon, 14 Sep 2015 00:47:10 +0000 (-0400) Subject: Fix: compat_futex_noasync: don't override return value X-Git-Tag: v0.7.16~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=19837093d3c31d90d06828f8a87e5e002f576b9d;p=urcu.git Fix: compat_futex_noasync: don't override return value Fix error reported by Coverity: ** CID 1324336: Code maintainability issues (UNUSED_VALUE) /compat_futex.c: 99 in compat_futex_noasync() Signed-off-by: Mathieu Desnoyers --- diff --git a/compat_futex.c b/compat_futex.c index a357134..0cc2956 100644 --- a/compat_futex.c +++ b/compat_futex.c @@ -54,7 +54,7 @@ pthread_cond_t __urcu_compat_futex_cond = PTHREAD_COND_INITIALIZER; int compat_futex_noasync(int32_t *uaddr, int op, int32_t val, const struct timespec *timeout, int32_t *uaddr2, int32_t val3) { - int ret; + int ret, lockret; /* * Check if NULL. Don't let users expect that they are taken into @@ -69,9 +69,9 @@ int compat_futex_noasync(int32_t *uaddr, int op, int32_t val, */ cmm_smp_mb(); - ret = pthread_mutex_lock(&__urcu_compat_futex_lock); - if (ret) { - errno = ret; + lockret = pthread_mutex_lock(&__urcu_compat_futex_lock); + if (lockret) { + errno = lockret; ret = -1; goto end; } @@ -98,9 +98,9 @@ int compat_futex_noasync(int32_t *uaddr, int op, int32_t val, errno = EINVAL; ret = -1; } - ret = pthread_mutex_unlock(&__urcu_compat_futex_lock); - if (ret) { - errno = ret; + lockret = pthread_mutex_unlock(&__urcu_compat_futex_lock); + if (lockret) { + errno = lockret; ret = -1; } end: