Martin Storsjö <[email protected]> writes:

> Make sure we actually have an error code in ret, in case
> getsockopt failed.
> ---
>  libavformat/tcp.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> index e7c6210..f1bad84 100644
> --- a/libavformat/tcp.c
> +++ b/libavformat/tcp.c
> @@ -139,7 +139,8 @@ static int tcp_open(URLContext *h, const char *uri, int 
> flags)
>          }
>          /* test error */
>          optlen = sizeof(ret);
> -        getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
> +        if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen))
> +            ret = AVUNERROR(ff_neterrno());
>          if (ret != 0) {
>              char errbuf[100];
>              ret = AVERROR(ret);
> -- 

LGTM

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to