Fix to disable log output for WOLFSSL_ERROR with WOLFSSL_NGINX defined. Cleanup on the loggingEnabled.

This commit is contained in:
David Garske
2018-01-02 19:30:33 -08:00
parent d0bd52910f
commit ab3d1e85cf
2 changed files with 19 additions and 17 deletions

View File

@ -123,7 +123,6 @@ static void wolfssl_log(const int logLevel, const char *const logMessage)
if (log_function)
log_function(logLevel, logMessage);
else {
if (loggingEnabled) {
#if defined(WOLFSSL_USER_LOG)
WOLFSSL_USER_LOG(logMessage);
#elif defined(WOLFSSL_LOG_PRINTF)
@ -147,7 +146,6 @@ static void wolfssl_log(const int logLevel, const char *const logMessage)
fprintf(stderr, "%s\n", logMessage);
#endif
}
}
}
#ifndef WOLFSSL_DEBUG_ERRORS_ONLY
@ -232,8 +230,8 @@ void WOLFSSL_ERROR_LINE(int error, const char* func, unsigned int line,
void WOLFSSL_ERROR(int error)
#endif
{
#if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_NGINX)
if (loggingEnabled && error != WC_PENDING_E)
#ifdef WOLFSSL_ASYNC_CRYPT
if (error != WC_PENDING_E)
#endif
{
char buffer[WOLFSSL_MAX_ERROR_SZ];
@ -267,6 +265,7 @@ void WOLFSSL_ERROR(int error)
#endif
#ifdef DEBUG_WOLFSSL
if (loggingEnabled)
wolfssl_log(ERROR_LOG , buffer);
#endif
}

View File

@ -15100,11 +15100,14 @@ int logging_test(void)
WOLFSSL_BUFFER(NULL, 0);
WOLFSSL_ERROR(MEMORY_E);
WOLFSSL_ERROR_MSG(msg);
i = log_cnt; /* capture log count */
/* turn off logs */
wolfSSL_Debugging_OFF();
/* capture log count */
i = log_cnt;
/* validate no logs are output when disabled */
WOLFSSL_MSG(msg);
WOLFSSL_BUFFER(a, sizeof(a));
WOLFSSL_BUFFER(b, sizeof(b));