summaryrefslogtreecommitdiff
path: root/libavformat/file.c
diff options
context:
space:
mode:
authorMaksym Veremeyenko <verem@m1stereo.tv>2011-10-03 07:47:39 +0300
committerMichael Niedermayer <michaelni@gmx.at>2011-10-07 22:28:07 +0200
commit4052bf69ac13934e0ab7e2e48688df8e463be92a (patch)
treec60db24dc7115693d02239a72761fafcd9af035c /libavformat/file.c
parentf22bc68dc0de214ba893c15e2a5e80731ab19959 (diff)
return error code if error happens
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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 a9c5281102..ffbccba0a4 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)