Blame pr-2393-2.patch

Andy Lutomirski f3c942
commit 2d1a32ab4b0ce488726dd8929c85840dc73ed7dd
Andy Lutomirski f3c942
Author: Andy Lutomirski <luto@kernel.org>
Andy Lutomirski f3c942
Date:   Tue Sep 15 18:27:52 2015 -0700
Andy Lutomirski f3c942
Andy Lutomirski f3c942
    Switch show_stackframe to backtrace_symbols_fd
Andy Lutomirski f3c942
    
Andy Lutomirski f3c942
    It's simpler and avoids calling into fprintf in contexts in which
Andy Lutomirski f3c942
    it might crash or deadlock.
Andy Lutomirski f3c942
Andy Lutomirski f3c942
diff --git a/src/common.cpp b/src/common.cpp
Andy Lutomirski f3c942
index 78d0e23865c5..f5eb2ca5b921 100644
Andy Lutomirski f3c942
--- a/src/common.cpp
Andy Lutomirski f3c942
+++ b/src/common.cpp
Andy Lutomirski f3c942
@@ -90,17 +90,8 @@ void show_stackframe()
Andy Lutomirski f3c942
     int trace_size = 0;
Andy Lutomirski f3c942
 
Andy Lutomirski f3c942
     trace_size = backtrace(trace, 32);
Andy Lutomirski f3c942
-    char **messages = backtrace_symbols(trace, trace_size);
Andy Lutomirski f3c942
-
Andy Lutomirski f3c942
-    if (messages)
Andy Lutomirski f3c942
-    {
Andy Lutomirski f3c942
-        debug(0, L"Backtrace:");
Andy Lutomirski f3c942
-        for (int i=0; i
Andy Lutomirski f3c942
-        {
Andy Lutomirski f3c942
-            fwprintf(stderr, L"%s\n", messages[i]);
Andy Lutomirski f3c942
-        }
Andy Lutomirski f3c942
-        free(messages);
Andy Lutomirski f3c942
-    }
Andy Lutomirski f3c942
+    debug(0, L"Backtrace:");
Andy Lutomirski f3c942
+    backtrace_symbols_fd(trace, trace_size, STDERR_FILENO);
Andy Lutomirski f3c942
 }
Andy Lutomirski f3c942
 
Andy Lutomirski f3c942
 int fgetws2(wcstring *s, FILE *f)