mirror of https://github.com/ARMmbed/mbed-os.git
Check that MBEDTLS_ERROR_C is defined before using mbedtls_strerror().
If MBEDTLS_ERROR_C is not defined, that strerror function does not exist, or is just dummy definition if MBEDTLS_ERROR_STRERROR_DUMMY is defined.pull/8311/head
parent
7f39bb4453
commit
5d1cd2552b
|
@ -272,10 +272,15 @@ nsapi_size_or_error_t TLSSocketWrapper::recvfrom(SocketAddress *address, void *d
|
|||
}
|
||||
|
||||
void TLSSocketWrapper::print_mbedtls_error(const char *name, int err) {
|
||||
#ifdef MBEDTLS_ERROR_C
|
||||
char *buf = new char[128];
|
||||
mbedtls_strerror(err, buf, 128);
|
||||
tr_err("%s() failed: -0x%04x (%d): %s", name, -err, err, buf);
|
||||
delete[] buf;
|
||||
#else
|
||||
(void)name;
|
||||
(void)err;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue