-/* $OpenBSD: tls.c,v 1.98 2023/07/02 06:37:27 beck Exp $ */
+/* $OpenBSD: tls.c,v 1.99 2024/03/26 00:50:22 joshua Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
{
free(error->msg);
error->msg = NULL;
- error->num = 0;
+ error->errno_value = 0;
error->tls = 0;
}
static int
-tls_error_vset(struct tls_error *error, int errnum, const char *fmt, va_list ap)
+tls_error_vset(struct tls_error *error, int errno_value, const char *fmt, va_list ap)
{
char *errmsg = NULL;
int rv = -1;
tls_error_clear(error);
- error->num = errnum;
+ error->errno_value = errno_value;
error->tls = 1;
if (vasprintf(&errmsg, fmt, ap) == -1) {
goto err;
}
- if (errnum == -1) {
+ if (errno_value == -1) {
error->msg = errmsg;
return (0);
}
- if (asprintf(&error->msg, "%s: %s", errmsg, strerror(errnum)) == -1) {
+ if (asprintf(&error->msg, "%s: %s", errmsg, strerror(errno_value)) == -1) {
error->msg = NULL;
goto err;
}
tls_error_set(struct tls_error *error, const char *fmt, ...)
{
va_list ap;
- int errnum, rv;
+ int errno_value, rv;
- errnum = errno;
+ errno_value = errno;
va_start(ap, fmt);
- rv = tls_error_vset(error, errnum, fmt, ap);
+ rv = tls_error_vset(error, errno_value, fmt, ap);
va_end(ap);
return (rv);
free(ctx->error.msg);
ctx->error.msg = NULL;
- ctx->error.num = -1;
+ ctx->error.errno_value = -1;
tls_conninfo_free(ctx->conninfo);
ctx->conninfo = NULL;
-/* $OpenBSD: tls_internal.h,v 1.83 2023/06/27 18:19:59 tb Exp $ */
+/* $OpenBSD: tls_internal.h,v 1.84 2024/03/26 00:50:22 joshua Exp $ */
/*
* Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org>
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
struct tls_error {
char *msg;
- int num;
+ int errno_value;
int tls;
};