Merge commit 'e05f7ed5436207f4a55f1978b223c7f8bc82af42'

* commit 'e05f7ed5436207f4a55f1978b223c7f8bc82af42':
  file: properly forward errors from file_read() and file_write()

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
Hendrik Leppkes 2015-09-07 16:11:57 +02:00
commit 88e7ea3e56

View File

@ -105,19 +105,19 @@ static const AVClass pipe_class = {
static int file_read(URLContext *h, unsigned char *buf, int size)
{
FileContext *c = h->priv_data;
int r;
int ret;
size = FFMIN(size, c->blocksize);
r = read(c->fd, buf, size);
return (-1 == r)?AVERROR(errno):r;
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;
int r;
int ret;
size = FFMIN(size, c->blocksize);
r = write(c->fd, buf, size);
return (-1 == r)?AVERROR(errno):r;
ret = write(c->fd, buf, size);
return (ret == -1) ? AVERROR(errno) : ret;
}
static int file_get_handle(URLContext *h)