doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

Blame SOURCES/0260-xorg-rewrite-skip_pfx-function-to-work-with-journal-.patch

a60cd7
From e001949d7ef821d7934e9d1756856ea8630968e5 Mon Sep 17 00:00:00 2001
a60cd7
From: Matej Habrnal <mhabrnal@redhat.com>
a60cd7
Date: Mon, 23 Jan 2017 11:36:16 +0100
a60cd7
Subject: [PATCH] xorg: rewrite skip_pfx() function to work with journal msgs
a60cd7
a60cd7
skip_pfx() removes substrings which starts with '[' and end with ']'.
a60cd7
Xorg journal messages which we can remove can also start with "(EE)" and end
a60cd7
with ']'.
a60cd7
a60cd7
Related to #1328264
a60cd7
a60cd7
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
a60cd7
---
a60cd7
 src/plugins/abrt-dump-xorg.c | 26 +++++++++++++++++---------
a60cd7
 1 file changed, 17 insertions(+), 9 deletions(-)
a60cd7
a60cd7
diff --git a/src/plugins/abrt-dump-xorg.c b/src/plugins/abrt-dump-xorg.c
a60cd7
index 434dc76..14fd561 100644
a60cd7
--- a/src/plugins/abrt-dump-xorg.c
a60cd7
+++ b/src/plugins/abrt-dump-xorg.c
a60cd7
@@ -44,16 +44,24 @@ static unsigned g_bt_count = 0;
a60cd7
 static unsigned g_opts;
a60cd7
 static const char *debug_dumps_dir = ".";
a60cd7
 
a60cd7
-static char *skip_pfx(char *p)
a60cd7
+static char *skip_pfx(char *str)
a60cd7
 {
a60cd7
-    if (p[0] != '[')
a60cd7
-        return p;
a60cd7
-    char *q = strchr(p, ']');
a60cd7
-    if (!q)
a60cd7
-        return p;
a60cd7
-    if (q[1] == ' ')
a60cd7
-        return q + 2;
a60cd7
-    return p;
a60cd7
+    if (str[0] == '[')
a60cd7
+    {
a60cd7
+        char *q = strchr(str, ']');
a60cd7
+        if (q)
a60cd7
+            str = q + 1;
a60cd7
+    }
a60cd7
+
a60cd7
+    if (str[0] == ' ')
a60cd7
+        ++str;
a60cd7
+
a60cd7
+    /* if there is (EE), ignore it */
a60cd7
+    if (strncmp(str, "(EE)", 4) == 0)
a60cd7
+        /* if ' ' follows (EE), ignore it too */
a60cd7
+        return str + (4 + (str[4] == ' '));
a60cd7
+
a60cd7
+    return str;
a60cd7
 }
a60cd7
 
a60cd7
 static char *list2lines(GList *list)
a60cd7
-- 
a60cd7
1.8.3.1
a60cd7