aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/file.c
diff options
context:
space:
mode:
authorSean McGovern <gseanmcg@gmail.com>2015-08-27 00:04:15 -0400
committerLuca Barbato <lu_zero@gentoo.org>2015-09-03 13:39:34 +0200
commite05f7ed5436207f4a55f1978b223c7f8bc82af42 (patch)
tree7b9885556b9bd1a583289da34c0d43a899f1d967 /libavformat/file.c
parent5a1a9da8a7ae120f2543b8f2fa13dc8baac39f17 (diff)
downloadffmpeg-e05f7ed5436207f4a55f1978b223c7f8bc82af42.tar.gz
file: properly forward errors from file_read() and file_write()
Bug-Id: 881 CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/file.c')
-rw-r--r--libavformat/file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/file.c b/libavformat/file.c
index 2837e9f150..b54db9aea6 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -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)