diff --git a/libavformat/avio.c b/libavformat/avio.c index 0a09cf1c44..936a3d979c 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -287,14 +287,14 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int int ffurl_read(URLContext *h, unsigned char *buf, int size) { - if (h->flags & AVIO_FLAG_WRITE) + if (!(h->flags & AVIO_FLAG_READ)) return AVERROR(EIO); return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read); } int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) { - if (h->flags & AVIO_FLAG_WRITE) + if (!(h->flags & AVIO_FLAG_READ)) return AVERROR(EIO); return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); }