diff mbox

[FFmpeg-devel,v2] libavformat/tcp: fix return code for tcp_accept

Message ID 20170408122128.24991-1-ffmpeg-dev@c-14.de
State Accepted
Commit 54b6bef6e13adf377c78c28ede22a4322ab28865
Headers show

Commit Message

Simon Thelen April 8, 2017, 12:21 p.m. UTC
ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
undefined), return ret instead and return ff_neterror() in
ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
Windows.
---
v2 rewords the commit message to better elucidate the issue.

 libavformat/network.c | 2 +-
 libavformat/tcp.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Thelen April 20, 2017, 3:01 a.m. UTC | #1
On 17-04-08 at 14:21, Simon Thelen wrote:
> ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
> undefined), return ret instead and return ff_neterror() in
> ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
> Windows.
> ---
> v2 rewords the commit message to better elucidate the issue.
> 
>  libavformat/network.c | 2 +-
>  libavformat/tcp.c     | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/network.c b/libavformat/network.c
> index 2fb1c8b02a..b3987a4d11 100644
> --- a/libavformat/network.c
> +++ b/libavformat/network.c
> @@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout,
>      if (!ret)
>          return AVERROR(ETIMEDOUT);
>      if (ret < 0)
> -        return AVERROR(errno);
> +        return ff_neterrno();
>      return ret;
>  }
>  
> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> index 3055e48015..07b4ed9fa3 100644
> --- a/libavformat/tcp.c
> +++ b/libavformat/tcp.c
> @@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c)
>      cc = (*c)->priv_data;
>      ret = ff_accept(sc->fd, sc->listen_timeout, s);
>      if (ret < 0)
> -        return ff_neterrno();
> +        return ret;
>      cc->fd = ret;
>      return 0;
>  }
> -- 
> 2.12.2
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

ping
Simon Thelen May 8, 2017, 8:58 a.m. UTC | #2
On 17-04-20 at 05:01, Simon Thelen wrote:
> On 17-04-08 at 14:21, Simon Thelen wrote:
> > ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
> > undefined), return ret instead and return ff_neterror() in
> > ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
> > Windows.
> > ---
> > v2 rewords the commit message to better elucidate the issue.
> > 
> >  libavformat/network.c | 2 +-
> >  libavformat/tcp.c     | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavformat/network.c b/libavformat/network.c
> > index 2fb1c8b02a..b3987a4d11 100644
> > --- a/libavformat/network.c
> > +++ b/libavformat/network.c
> > @@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout,
> >      if (!ret)
> >          return AVERROR(ETIMEDOUT);
> >      if (ret < 0)
> > -        return AVERROR(errno);
> > +        return ff_neterrno();
> >      return ret;
> >  }
> >  
> > diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> > index 3055e48015..07b4ed9fa3 100644
> > --- a/libavformat/tcp.c
> > +++ b/libavformat/tcp.c
> > @@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c)
> >      cc = (*c)->priv_data;
> >      ret = ff_accept(sc->fd, sc->listen_timeout, s);
> >      if (ret < 0)
> > -        return ff_neterrno();
> > +        return ret;
> >      cc->fd = ret;
> >      return 0;
> >  }
> > -- 
> > 2.12.2
> > 
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> ping
> 
ping?
Michael Niedermayer May 10, 2017, 11:13 a.m. UTC | #3
On Mon, May 08, 2017 at 10:58:35AM +0200, Simon Thelen wrote:
> On 17-04-20 at 05:01, Simon Thelen wrote:
> > On 17-04-08 at 14:21, Simon Thelen wrote:
> > > ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
> > > undefined), return ret instead and return ff_neterror() in
> > > ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
> > > Windows.
> > > ---
> > > v2 rewords the commit message to better elucidate the issue.
> > > 
> > >  libavformat/network.c | 2 +-
> > >  libavformat/tcp.c     | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/libavformat/network.c b/libavformat/network.c
> > > index 2fb1c8b02a..b3987a4d11 100644
> > > --- a/libavformat/network.c
> > > +++ b/libavformat/network.c
> > > @@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout,
> > >      if (!ret)
> > >          return AVERROR(ETIMEDOUT);
> > >      if (ret < 0)
> > > -        return AVERROR(errno);
> > > +        return ff_neterrno();
> > >      return ret;
> > >  }
> > >  
> > > diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> > > index 3055e48015..07b4ed9fa3 100644
> > > --- a/libavformat/tcp.c
> > > +++ b/libavformat/tcp.c
> > > @@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c)
> > >      cc = (*c)->priv_data;
> > >      ret = ff_accept(sc->fd, sc->listen_timeout, s);
> > >      if (ret < 0)
> > > -        return ff_neterrno();
> > > +        return ret;
> > >      cc->fd = ret;
> > >      return 0;
> > >  }
> > > -- 
> > > 2.12.2
> > > 
> > > _______________________________________________
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > ping
> > 
> ping?

applied

thx

[...]
diff mbox

Patch

diff --git a/libavformat/network.c b/libavformat/network.c
index 2fb1c8b02a..b3987a4d11 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -159,7 +159,7 @@  static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout,
     if (!ret)
         return AVERROR(ETIMEDOUT);
     if (ret < 0)
-        return AVERROR(errno);
+        return ff_neterrno();
     return ret;
 }
 
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 3055e48015..07b4ed9fa3 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -204,7 +204,7 @@  static int tcp_accept(URLContext *s, URLContext **c)
     cc = (*c)->priv_data;
     ret = ff_accept(sc->fd, sc->listen_timeout, s);
     if (ret < 0)
-        return ff_neterrno();
+        return ret;
     cc->fd = ret;
     return 0;
 }