mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-22 07:37:38 +01:00
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.
This commit is contained in:
parent
7263a97ced
commit
848ad53a47
1 changed files with 2 additions and 1 deletions
|
@ -89,7 +89,8 @@ do_backtrace (int may_print, int get_proc_name)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue