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

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