doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

Blame SOURCES/0152-abrt-hook-ccpp-save-core_backtrace-from-hook.patch

47a88a
From 48c53164aebf9c07606e08f7108d0f7272d48d70 Mon Sep 17 00:00:00 2001
47a88a
From: Richard Marko <rmarko@fedoraproject.org>
47a88a
Date: Fri, 17 Jul 2015 13:52:35 +0200
47a88a
Subject: [PATCH] abrt-hook-ccpp: save core_backtrace from hook
47a88a
47a88a
Don't use satyr for saving the file.
47a88a
47a88a
Signed-off-by: Richard Marko <rmarko@fedoraproject.org>
47a88a
---
47a88a
 src/hooks/abrt-hook-ccpp.c | 14 +++++++++-----
47a88a
 1 file changed, 9 insertions(+), 5 deletions(-)
47a88a
47a88a
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
47a88a
index d95228f..6759fc0 100644
47a88a
--- a/src/hooks/abrt-hook-ccpp.c
47a88a
+++ b/src/hooks/abrt-hook-ccpp.c
47a88a
@@ -585,21 +585,25 @@ static int create_or_die(const char *filename, int user_core_fd)
47a88a
     perror_msg_and_die("Can't open '%s'", filename);
47a88a
 }
47a88a
 
47a88a
-static void create_core_backtrace(pid_t tid, const char *executable, int signal_no, const char *dd_path)
47a88a
+static void create_core_backtrace(pid_t tid, const char *executable, int signal_no, struct dump_dir *dd)
47a88a
 {
47a88a
 #ifdef ENABLE_DUMP_TIME_UNWIND
47a88a
     if (g_verbose > 1)
47a88a
         sr_debug_parser = true;
47a88a
 
47a88a
     char *error_message = NULL;
47a88a
-    bool success = sr_abrt_create_core_stacktrace_from_core_hook(dd_path, tid, executable,
47a88a
-                                                                 signal_no, &error_message);
47a88a
+    char *core_bt = sr_abrt_get_core_stacktrace_from_core_hook(tid, executable,
47a88a
+                                                               signal_no, &error_message);
47a88a
 
47a88a
-    if (!success)
47a88a
+    if (core_bt == NULL)
47a88a
     {
47a88a
         log("Failed to create core_backtrace: %s", error_message);
47a88a
         free(error_message);
47a88a
+        return;
47a88a
     }
47a88a
+
47a88a
+    dd_save_text(dd, FILENAME_CORE_BACKTRACE, core_bt);
47a88a
+    free(core_bt);
47a88a
 #endif /* ENABLE_DUMP_TIME_UNWIND */
47a88a
 }
47a88a
 
47a88a
@@ -1028,7 +1032,7 @@ int main(int argc, char** argv)
47a88a
 
47a88a
         /* Perform crash-time unwind of the guilty thread. */
47a88a
         if (tid > 0 && setting_CreateCoreBacktrace)
47a88a
-            create_core_backtrace(tid, executable, signal_no, dd->dd_dirname);
47a88a
+            create_core_backtrace(tid, executable, signal_no, dd);
47a88a
 
47a88a
         /* We close dumpdir before we start catering for crash storm case.
47a88a
          * Otherwise, delete_dump_dir's from other concurrent
47a88a
-- 
47a88a
2.4.3
47a88a