On 07 Mar 2010, at 12:13 AM, Graham Leggett wrote:

Can anyone tell me what function I should be using to retrieve the error saved by ERR_add_error_data()?

After some reverse engineering, it turns out ERR_get_error_line_data() does the trick. It was the file and line parameters that threw me off, if you don't need them, ignore them.

This code works for me:

                unsigned long e;
                const char *file = NULL, *data = NULL;
                int line, flags;
cfg->error = apr_psprintf(cfg->perror, "can't load CA file %s",
                    nscfg->CAfile);
while ((e = ERR_get_error_line_data(&file, &line, &data, &flags))) {
                cfg->error = apr_pstrcat(cfg->perror, cfg->error, ": ",
                        ERR_error_string(e, NULL), NULL);
                if (data) {
cfg->error = apr_pstrcat(cfg->perror, cfg->error, ": ", data, NULL);
                }
            }
            ERR_clear_error();

Regards,
Graham
--

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to