diff --git a/src/utils/channel.c b/src/utils/channel.c
index 6db9b9512310b8d626ea12f73e33e90a5ff3d34e..af41b477b4748252763123b8a0303aa5edc06676 100644 (file)
--- a/src/utils/channel.c
+++ b/src/utils/channel.c
if (timeout) {
struct timespec abstime;
- if (clock_gettime(CLOCK_REALTIME, &abstime))
+ if (clock_gettime(CLOCK_REALTIME, &abstime)) {
+ pthread_mutex_unlock(&chan->lock);
return -1;
+ }
abstime.tv_sec += timeout->tv_sec;
abstime.tv_nsec += timeout->tv_nsec;
else
status = pthread_cond_wait(&chan->cond, &chan->lock);
}
-
pthread_mutex_unlock(&chan->lock);
+
if (status) {
errno = status;
return -1;