diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/logs.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/logs.h b/src/core/logs.h index afdcfa2..4ddb6ab 100644 --- a/src/core/logs.h +++ b/src/core/logs.h @@ -26,6 +26,7 @@ #include <errno.h> +#include <netdb.h> #include <stdarg.h> #include <string.h> #include <openssl/err.h> @@ -87,6 +88,19 @@ void log_variadic_message(LogMessageType, const char *, ...); } \ while (0) +#define LOG_ERROR_GAI_N(func, errcode) \ + do \ + { \ + char __msg[1024]; \ + const char *__msg_ptr; \ + if (errcode == EAI_SYSTEM) \ + __msg_ptr = strerror_r(errno, __msg, sizeof(__msg)); \ + else \ + __msg_ptr = gai_strerror(errcode); \ + log_variadic_message(LMT_EXT_ERROR, "[%s:%u] %s: %s", __FUNCTION__, __LINE__, func, __msg_ptr); \ + } \ + while (0) + #define LOG_ERROR_OPENSSL \ do \ { \ |