]> git.sesse.net Git - ffmpeg/commitdiff
file: properly forward errors from file_read() and file_write()
authorSean McGovern <gseanmcg@gmail.com>
Thu, 27 Aug 2015 04:04:15 +0000 (00:04 -0400)
committerLuca Barbato <lu_zero@gentoo.org>
Thu, 3 Sep 2015 11:39:34 +0000 (13:39 +0200)
Bug-Id: 881

CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavformat/file.c

index 2837e9f150e05db0df5f1567ca46859be60e5835..b54db9aea6c42fb533089286d90d4412321a5e3e 100644 (file)
@@ -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)