On Sat, Nov 01, 2014 at 03:07:24AM +0100, Jan Klemkow wrote:
> Index: tls_client.c
> ===================================================================
> RCS file: /cvs/src/lib/libtls/tls_client.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 tls_client.c
> --- tls_client.c      31 Oct 2014 13:46:17 -0000      1.1
> +++ tls_client.c      1 Nov 2014 01:50:56 -0000
> @@ -123,6 +123,13 @@ err:
>  int
>  tls_connect_socket(struct tls *ctx, int socket, const char *hostname)
>  {
> +     return tls_connect_fds(ctx, socket, socket, hostname);
> +}

This changes the behavior of tls_connect_socket() and tls_connect().
Joel's diff set ctx->socket = socket before calling tls_connect_fds() so
it would behave the same.  When you call tls_close(ctx), it will close
ctx->socket in the existing code and Joel's diff.

I don't think you want to change the semantics like this.  I think
either tls_connect_fds() is the special case where you need to manually
close the sockets or tls_close() should close everything.  With the
above change, even people calling tls_connect() will need to save one of
the fd_(read|write) before calling tls_close() and then close the fd
afterward.

Reply via email to