arrfab / rpms / abrt

Forked from rpms/abrt 5 years ago
Clone

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

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