]> git.sesse.net Git - ffmpeg/commitdiff
avformat/udp: properly use return value of pthread_cond_timedwait
authorMarton Balint <cus@passwd.hu>
Tue, 14 Jan 2020 17:53:45 +0000 (18:53 +0100)
committerMarton Balint <cus@passwd.hu>
Sat, 25 Jan 2020 22:16:47 +0000 (23:16 +0100)
Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/udp.c

index f5f636e1af88bf7b8bc85ae8751576df900cf204..7e59d51cc661d6f9f4e0d98c59168613d431548c 100644 (file)
@@ -978,9 +978,10 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
                 int64_t t = av_gettime() + 100000;
                 struct timespec tv = { .tv_sec  =  t / 1000000,
                                        .tv_nsec = (t % 1000000) * 1000 };
-                if (pthread_cond_timedwait(&s->cond, &s->mutex, &tv) < 0) {
+                int err = pthread_cond_timedwait(&s->cond, &s->mutex, &tv);
+                if (err) {
                     pthread_mutex_unlock(&s->mutex);
-                    return AVERROR(errno == ETIMEDOUT ? EAGAIN : errno);
+                    return AVERROR(err == ETIMEDOUT ? EAGAIN : err);
                 }
                 nonblock = 1;
             }