ERROR_DUMP always clears the error queue. ERROR_CLEAR clears the queue
silently. One of them has to be called after an openssl error. ERROR_DUMP
should be called for errors that we do not recognize. ERROR_CLEAR for other
errors.
Change-Id: I90844271378a87f4897f66c9664edf60bcb1e218
void error_dump(const char *file, int line, const char *function, int code)
{
- if (error_cb == NULL)
+ if (error_cb == NULL) {
+ ERR_clear_error();
return;
+ }
static const size_t BUF_SIZE = 512;
static const char ELLIPSIS[] = "...\n";
#include <stddef.h>
#include <openssl/ossl_typ.h>
+#include <openssl/err.h>
#include <yaca/types.h>
void error_dump(const char *file, int line, const char *function, int code);
#define ERROR_DUMP(code) error_dump(__FILE__, __LINE__, __func__, (code))
+#define ERROR_CLEAR() ERR_clear_error()
#endif /* YACA_INTERNAL_H */