Title: ERR_get_error() or SSL_get_error()?

If SSL_accept() returns <= 0, and I want to see what the error is, should I be calling this to get a string description of the error:

int ret = SSL_accept();
if (ret <= 0)
{
        char buf[256];
        ERR_error_string_n(ERR_get_error(), buf, sizeof(buf));
}

Or should I be doing this instead

int ret = SSL_accept();
if (ret <= 0)
{
        char buf[256];
        ERR_error_string_n(SSL_get_error(), buf, sizeof(buf));
}

Under what circumstances do I use each of those API's?

Thanks,
Ed

Reply via email to