[FFmpeg-devel] [PATCH] Use ff_neterrno instead of errno in tcp.c

Måns Rullgård mans
Tue Jul 14 11:05:45 CEST 2009


Martin Storsj? <martin at martin.st> writes:

> Hi,
>
> The attached patch gives better consistency; if ff_neterrno() is checked 
> instead of errno, that's probably what should be used in the return value, 
> too. (On windows, network errors aren't visible in errno.)
>
> // Martin
>
> ---
>  libavformat/tcp.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> index b7983e7..05676eb 100644
> --- a/libavformat/tcp.c
> +++ b/libavformat/tcp.c
> @@ -130,7 +130,7 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size)
>              if (len < 0) {
>                  if (ff_neterrno() != FF_NETERROR(EINTR) &&
>                      ff_neterrno() != FF_NETERROR(EAGAIN))
> -                    return AVERROR(errno);
> +                    return AVERROR(ff_neterrno());
>              } else return len;
>          } else if (ret < 0) {
>              return -1;
> @@ -160,7 +160,7 @@ static int tcp_write(URLContext *h, uint8_t *buf, int size)
>              if (len < 0) {
>                  if (ff_neterrno() != FF_NETERROR(EINTR) &&
>                      ff_neterrno() != FF_NETERROR(EAGAIN))
> -                    return AVERROR(errno);
> +                    return AVERROR(ff_neterrno());
>                  continue;
>              }
>              size -= len;

Makes sense.  Patch looks good, but I'm not maintainer of that file.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list