Call snprintf() from signal handler only if required in test-async-sig
snprintf() is not guaranteed to be safely callable from a signal
handler, so avoid calling it in the default non-verbose case.
diff --git a/tests/test-async-sig.c b/tests/test-async-sig.c
index ba37c90..9a0d39e 100644
--- a/tests/test-async-sig.c
+++ b/tests/test-async-sig.c
@@ -89,7 +89,8 @@
buf[0] = '\0';
if (get_proc_name || (may_print && verbose))
{
- if (unw_get_proc_name (&cursor, name, sizeof (name), &off) == 0)
+ ret = unw_get_proc_name (&cursor, name, sizeof (name), &off);
+ if (ret == 0 && (may_print && verbose))
{
if (off)
snprintf (buf, sizeof (buf), "<%s+0x%lx>", name, (long) off);