summaryrefslogtreecommitdiffstats
path: root/lib/libtls/tls_client.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2015-09-09 14:32:06 +0000
committerjsing <jsing@openbsd.org>2015-09-09 14:32:06 +0000
commitaa7238e62d6cc8e9f3e032b510a6896c1b6ce2c4 (patch)
tree545d950baf90a1b88d1698b94ce2616025c3de6d /lib/libtls/tls_client.c
parentKill some commented out in6_ifstat_inc(). (diff)
downloadwireguard-openbsd-aa7238e62d6cc8e9f3e032b510a6896c1b6ce2c4.tar.xz
wireguard-openbsd-aa7238e62d6cc8e9f3e032b510a6896c1b6ce2c4.zip
Only take ownership of a socket if we allocated it within libtls. If we are
passed a socket then the caller is responsible for closing it. ok bcook@
Diffstat (limited to 'lib/libtls/tls_client.c')
-rw-r--r--lib/libtls/tls_client.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libtls/tls_client.c b/lib/libtls/tls_client.c
index 55fb49ff782..81b55104311 100644
--- a/lib/libtls/tls_client.c
+++ b/lib/libtls/tls_client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_client.c,v 1.22 2015/09/08 15:29:34 jsing Exp $ */
+/* $OpenBSD: tls_client.c,v 1.23 2015/09/09 14:32:06 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -145,6 +145,8 @@ tls_connect_servername(struct tls *ctx, const char *host, const char *port,
goto err;
}
+ ctx->socket = s;
+
rv = 0;
err:
@@ -157,8 +159,6 @@ err:
int
tls_connect_socket(struct tls *ctx, int s, const char *servername)
{
- ctx->socket = s;
-
return tls_connect_fds(ctx, s, s, servername);
}