Blame SOURCES/0072-make_desc-add-reason-to-the-list.patch

0c9110
From 602457c6b4de8d4147bea2ab2264b360f7807636 Mon Sep 17 00:00:00 2001
0c9110
From: Matej Habrnal <mhabrnal@redhat.com>
0c9110
Date: Tue, 16 Sep 2014 05:30:28 +0200
0c9110
Subject: [LIBREPORT PATCH 72/93] make_desc: add reason to the list
0c9110
0c9110
Add reason in format "crash-function: reason". Add hostname to the uid line and
0c9110
add cmdline. Remove executable line.
0c9110
0c9110
Related to rhbz#1067440
0c9110
0c9110
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
0c9110
---
0c9110
 src/lib/make_descr.c   | 20 +++++++++++++++++++-
0c9110
 src/lib/problem_data.c |  3 ++-
0c9110
 2 files changed, 21 insertions(+), 2 deletions(-)
0c9110
0c9110
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
0c9110
index dcf517e..2bcbebd 100644
0c9110
--- a/src/lib/make_descr.c
0c9110
+++ b/src/lib/make_descr.c
0c9110
@@ -119,7 +119,25 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip,
0c9110
             char *output = formatted ? formatted : item->content;
0c9110
             int pad = 16 - (strlen(key) + 2);
0c9110
             if (pad < 0) pad = 0;
0c9110
-            strbuf_append_strf(buf_dsc, "%s: %*s%s\n", key, pad, "", output);
0c9110
+            bool done = false;
0c9110
+            if (strcmp(FILENAME_REASON, key) == 0)
0c9110
+            {
0c9110
+                const char *crash_func = problem_data_get_content_or_NULL(problem_data,
0c9110
+                                                                          FILENAME_CRASH_FUNCTION);
0c9110
+                if((done = (bool)crash_func))
0c9110
+                    strbuf_append_strf(buf_dsc, "%s: %*s%s(): %s\n", key, pad, "", crash_func, output);
0c9110
+            }
0c9110
+            else if (strcmp(FILENAME_UID, key) == 0)
0c9110
+            {
0c9110
+                const char *username = problem_data_get_content_or_NULL(problem_data,
0c9110
+                                                                          FILENAME_USERNAME);
0c9110
+                if((done = (bool)username))
0c9110
+                    strbuf_append_strf(buf_dsc, "%s: %*s%s (%s)\n", key, pad, "", output, username);
0c9110
+            }
0c9110
+
0c9110
+            if (!done)
0c9110
+                strbuf_append_strf(buf_dsc, "%s: %*s%s\n", key, pad, "", output);
0c9110
+
0c9110
             empty = false;
0c9110
             free(formatted);
0c9110
         }
0c9110
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
0c9110
index 18d9541..fc07288 100644
0c9110
--- a/src/lib/problem_data.c
0c9110
+++ b/src/lib/problem_data.c
0c9110
@@ -450,9 +450,10 @@ void problem_data_load_from_dump_dir(problem_data_t *problem_data, struct dump_d
0c9110
         static const char *const list_files[] = {
0c9110
             FILENAME_UID       ,
0c9110
             FILENAME_PACKAGE   ,
0c9110
-            FILENAME_EXECUTABLE,
0c9110
+            FILENAME_CMDLINE   ,
0c9110
             FILENAME_TIME      ,
0c9110
             FILENAME_COUNT     ,
0c9110
+            FILENAME_REASON    ,
0c9110
             NULL
0c9110
         };
0c9110
         if (is_in_string_list(short_name, (char**)list_files))
0c9110
-- 
0c9110
1.8.3.1
0c9110