On Fri, 2013-11-22 at 13:26 +0100, Daniel Wagner wrote:
> From: Daniel Wagner <[email protected]>
>
> When connect() fails we should close the socket.
>
> Reported by coverity.
> ---
> tools/dnsproxy-test.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c
> index 84602b6..ad707f3 100644
> --- a/tools/dnsproxy-test.c
> +++ b/tools/dnsproxy-test.c
> @@ -147,6 +147,9 @@ static int connect_tcp_socket(char *server)
>
> if (sk >= 0 && connect(sk, rp->ai_addr, rp->ai_addrlen) < 0) {
> err = -errno;
> + close(sk);
> + sk = 0;
A value of -1 here, please. Zero is a valid value and checked three
lines above as well.
> fprintf(stderr, "Failed to connect to DNS server at %s "
> "errno %d/%s\n",
> server, -err, strerror(-err));
Cheers,
Patrik
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman