[FFmpeg-cvslog] return error code if error happens

Maksym Veremeyenko git at videolan.org
Fri Oct 7 22:42:07 CEST 2011


ffmpeg | branch: master | Maksym Veremeyenko <verem at m1stereo.tv> | Mon Oct  3 07:47:39 2011 +0300| [4052bf69ac13934e0ab7e2e48688df8e463be92a] | committer: Michael Niedermayer

return error code if error happens

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4052bf69ac13934e0ab7e2e48688df8e463be92a
---

 libavformat/file.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index a9c5281..ffbccba 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -37,13 +37,15 @@
 static int file_read(URLContext *h, unsigned char *buf, int size)
 {
     int fd = (intptr_t) h->priv_data;
-    return read(fd, buf, size);
+    int r = read(fd, buf, size);
+    return (-1 == r)?AVERROR(errno):r;
 }
 
 static int file_write(URLContext *h, const unsigned char *buf, int size)
 {
     int fd = (intptr_t) h->priv_data;
-    return write(fd, buf, size);
+    int r = write(fd, buf, size);
+    return (-1 == r)?AVERROR(errno):r;
 }
 
 static int file_get_handle(URLContext *h)



More information about the ffmpeg-cvslog mailing list