summaryrefslogtreecommitdiff
path: root/p11-kit/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'p11-kit/debug.c')
-rw-r--r--p11-kit/debug.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/p11-kit/debug.c b/p11-kit/debug.c
index 37095be..a665d0f 100644
--- a/p11-kit/debug.c
+++ b/p11-kit/debug.c
@@ -59,6 +59,7 @@ static struct DebugKey debug_keys[] = {
};
static int debug_inited = 0;
+static int debug_strict = 0;
/* global variable exported in debug.h */
int _p11_debug_current_flags = ~0;
@@ -72,6 +73,10 @@ parse_environ_flags (void)
const char *q;
int i;
+ env = getenv ("P11_KIT_STRICT");
+ if (env && env[0] != '\0')
+ debug_strict = 1;
+
env = getenv ("P11_KIT_DEBUG");
if (!env)
return 0;
@@ -130,3 +135,17 @@ _p11_debug_message (int flag,
fprintf (stderr, "(p11-kit:%d) %s\n", getpid(), buffer);
}
}
+
+void
+_p11_debug_precond (const char *format,
+ ...)
+{
+ va_list va;
+
+ va_start (va, format);
+ vfprintf (stderr, format, va);
+ va_end (va);
+
+ if (debug_strict)
+ abort ();
+}