From a76c33e48e3fd7b639ae7c4f446a95163f4e8ab2 Mon Sep 17 00:00:00 2001 From: Otto Date: Fri, 24 Sep 2021 14:40:57 +0200 Subject: [PATCH] Better error messages --- pdns/libssl.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pdns/libssl.cc b/pdns/libssl.cc index 076a8d39bc..1f67eabb57 100644 --- a/pdns/libssl.cc +++ b/pdns/libssl.cc @@ -21,6 +21,8 @@ #include #endif /* HAVE_LIBSODIUM */ +#include "misc.hh" + #if (OPENSSL_VERSION_NUMBER < 0x1010000fL || (defined LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2090100fL) /* OpenSSL < 1.1.0 needs support for threading/locking in the calling application. */ @@ -782,12 +784,13 @@ std::unique_ptr libssl_set_key_log_file(std::unique_ptr(fdopen(fd, "a"), fclose); if (!fp) { + int error = errno; // close might clobber errno close(fd); - throw std::runtime_error("Error opening TLS log file '" + logFile + "'"); + throw std::runtime_error("Error opening TLS log file '" + logFile + "': " + stringerror(error)); } SSL_CTX_set_ex_data(ctx.get(), s_keyLogIndex, fp.get()); -- 2.47.2