Commit b27428ec authored by Geoff Simmons's avatar Geoff Simmons

Add a fatal error handler.

parent aefa6489
Pipeline #170 skipped
......@@ -128,12 +128,23 @@ gcrypt_logger(void *priv, int level, const char *fmt, va_list args)
lvl = "DEBUG";
break;
default:
VSL(SLT_Error, 0, "Unknown gcrypt log level %d", level);
VSL(SLT_Error, 0, "Unknown libgcrypt log level %d", level);
}
VSL(tag, 0, "libgcrypt log message follows (%s):", lvl);
VSLv(tag, 0, fmt, args);
}
static void __match_proto__(gcry_handler_error_t)
gcrypt_fatal(void *priv, int err, const char *text)
{
(void) priv;
if (text == NULL)
text = gpg_strerror(err);
VSL(SLT_Error, 0, "libgcrypt fatal error, code=%d (%s), panic follows",
err, text);
AZ(text);
}
int __match_proto__(vmod_event_f)
event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
{
......@@ -144,6 +155,7 @@ event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
if (gcrypt_version != NULL)
return 0;
gcry_set_log_handler(gcrypt_logger, NULL);
gcry_set_fatalerror_handler(gcrypt_fatal, NULL);
gcrypt_version = gcry_check_version(MIN_GCRYPT_VERSION);
if (gcrypt_version == NULL) {
VSL(SLT_VCL_Error, 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment