From aa6b9486c9bcc62c3deb78d7e80976dccb4104c6 Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 16 Sep 2021 17:07:34 -0400 Subject: [PATCH] pthread_cond_timedwait() directly returns errno #2169 --- src/lib/in.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/in.c b/src/lib/in.c index 7f7a7e1ed..bffcccfd5 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -1826,10 +1826,10 @@ internal_get(inputctx* ictx, const struct timespec* ts, ncinput* ni){ if(ts == NULL){ pthread_cond_wait(&ictx->icond, &ictx->ilock); }else{ - if(pthread_cond_timedwait(&ictx->icond, &ictx->ilock, ts)){ - if(errno == ETIMEDOUT){ - return 0; - } + int r = pthread_cond_timedwait(&ictx->icond, &ictx->ilock, ts); + if(r == ETIMEDOUT){ + return 0; + }else if(r < 0){ inc_input_errors(ictx); return (uint32_t)-1; }