diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2015-09-10 10:59:23 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2015-09-10 10:59:23 +0000 |
commit | eaafd1ab5077a60b3f77319fb1b55dc9acce42f7 (patch) | |
tree | b5938f80e6c8e3b6f1dffe14aa6e769eaa04f266 /lib | |
parent | 8ea983a0981a10f46ca604d8ac7071ab7d74ab7e (diff) |
comment for errno clobbering, to indicate why we do this.
ok deraadt@ jsing@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libtls/tls.c | 6 | ||||
-rw-r--r-- | lib/libtls/tls_init.3 | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/libtls/tls.c b/lib/libtls/tls.c index 448b048b33c..4378c5980a8 100644 --- a/lib/libtls/tls.c +++ b/lib/libtls/tls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls.c,v 1.22 2015/09/10 10:26:49 beck Exp $ */ +/* $OpenBSD: tls.c,v 1.23 2015/09/10 10:59:22 beck Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -379,6 +379,7 @@ tls_handshake(struct tls *ctx) else if ((ctx->flags & TLS_SERVER_CONN) != 0) rv = tls_handshake_server(ctx); + /* Prevent callers from performing incorrect error handling */ errno = 0; return (rv); } @@ -406,6 +407,7 @@ tls_read(struct tls *ctx, void *buf, size_t buflen) rv = (ssize_t)tls_ssl_error(ctx, ctx->ssl_conn, ssl_ret, "read"); out: + /* Prevent callers from performing incorrect error handling */ errno = 0; return (rv); } @@ -433,6 +435,7 @@ tls_write(struct tls *ctx, const void *buf, size_t buflen) rv = (ssize_t)tls_ssl_error(ctx, ctx->ssl_conn, ssl_ret, "write"); out: + /* Prevent callers from performing incorrect error handling */ errno = 0; return (rv); } @@ -470,6 +473,7 @@ tls_close(struct tls *ctx) ctx->socket = -1; } out: + /* Prevent callers from performing incorrect error handling */ errno = 0; return (rv); } diff --git a/lib/libtls/tls_init.3 b/lib/libtls/tls_init.3 index 17822d444d8..1c27c9be2c8 100644 --- a/lib/libtls/tls_init.3 +++ b/lib/libtls/tls_init.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tls_init.3,v 1.26 2015/09/10 09:10:42 jsing Exp $ +.\" $OpenBSD: tls_init.3,v 1.27 2015/09/10 10:59:22 beck Exp $ .\" .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> .\" @@ -435,16 +435,16 @@ and function families, have two special return values: .Pp .Bl -tag -width "TLS_WRITE_AGAIN" -offset indent -compact -.It Dv TLS_READ_AGAIN +.It Dv TLS_WANT_POLLIN A read operation is necessary to continue. -.It Dv TLS_WRITE_AGAIN +.It Dv TLS_WANT_POLLOUT A write operation is necessary to continue. .El .Pp There are underlying TLS engine read or write operations which may not correspond with the name of the function called. For example, it is possible to receive a -.Dv TLS_READ_AGAIN +.Dv TLS_WANT_POLLIN even when calling .Fn tls_write . .Pp |