[FFmpeg-devel] libavformat/file: return AVERROR_EOF on EOF

Submitted by Daniel Kucera on June 5, 2017, 6:30 p.m.

Details

Message ID 20170605183016.18669-1-daniel.kucera@gmail.com
State New
Headers show

Commit Message

Daniel Kucera June 5, 2017, 6:30 p.m.
Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
---
 libavformat/file.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Nicolas George June 15, 2017, 8:21 a.m.
Le septidi 17 prairial, an CCXXV, Daniel Kucera a écrit :
> Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
> ---
>  libavformat/file.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/file.c b/libavformat/file.c
> index 264542a36a..1fb83851c0 100644
> --- a/libavformat/file.c
> +++ b/libavformat/file.c
> @@ -112,6 +112,8 @@ static int file_read(URLContext *h, unsigned char *buf, int size)
>      ret = read(c->fd, buf, size);
>      if (ret == 0 && c->follow)
>          return AVERROR(EAGAIN);
> +    if (ret == 0)
> +        return AVERROR_EOF; 
>      return (ret == -1) ? AVERROR(errno) : ret;
>  }
>  

LGTM, but I do not maintain that file.

Regards,
Michael Niedermayer June 17, 2017, 7:54 p.m.
On Thu, Jun 15, 2017 at 10:21:00AM +0200, Nicolas George wrote:
> Le septidi 17 prairial, an CCXXV, Daniel Kucera a écrit :
> > Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
> > ---
> >  libavformat/file.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavformat/file.c b/libavformat/file.c
> > index 264542a36a..1fb83851c0 100644
> > --- a/libavformat/file.c
> > +++ b/libavformat/file.c
> > @@ -112,6 +112,8 @@ static int file_read(URLContext *h, unsigned char *buf, int size)
> >      ret = read(c->fd, buf, size);
> >      if (ret == 0 && c->follow)
> >          return AVERROR(EAGAIN);
> > +    if (ret == 0)
> > +        return AVERROR_EOF; 
> >      return (ret == -1) ? AVERROR(errno) : ret;
> >  }
> >  
> 
> LGTM, but I do not maintain that file.

applied

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/file.c b/libavformat/file.c
index 264542a36a..1fb83851c0 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -112,6 +112,8 @@  static int file_read(URLContext *h, unsigned char *buf, int size)
     ret = read(c->fd, buf, size);
     if (ret == 0 && c->follow)
         return AVERROR(EAGAIN);
+    if (ret == 0)
+        return AVERROR_EOF; 
     return (ret == -1) ? AVERROR(errno) : ret;
 }