Commit e05f7ed5 authored by Sean McGovern's avatar Sean McGovern Committed by Luca Barbato

file: properly forward errors from file_read() and file_write()

Bug-Id: 881

CC: libav-stable@libav.org
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent 5a1a9da8
......@@ -59,13 +59,15 @@ static const AVClass file_class = {
static int file_read(URLContext *h, unsigned char *buf, int size)
{
FileContext *c = h->priv_data;
return read(c->fd, buf, size);
int ret = read(c->fd, buf, size);
return (ret == -1) ? AVERROR(errno) : ret;
}
static int file_write(URLContext *h, const unsigned char *buf, int size)
{
FileContext *c = h->priv_data;
return write(c->fd, buf, size);
int ret = write(c->fd, buf, size);
return (ret == -1) ? AVERROR(errno) : ret;
}
static int file_get_handle(URLContext *h)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment