Skip to content

Commit

Permalink
xorg: rewrite skip_pfx() function to work with journal msgs
Browse files Browse the repository at this point in the history
skip_pfx() expecting string which starts with '[' but
Xorg journal messages do not start with '[' but with '(EE)'.

Resolves #1023
Related to rhbz#1246373

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
  • Loading branch information
Matej Habrnal committed Nov 6, 2015
1 parent bac3ed1 commit 0fc265b
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/plugins/xorg-utils.c
Expand Up @@ -49,28 +49,24 @@ void xorg_crash_info_free(struct xorg_crash_info *crash_info)
free(crash_info);
}

/* TODO */
char *skip_pfx(char *p)
char *skip_pfx(char *str)
{
if (p[0] != '[')
return p;
char *q = strchr(p, ']');
if (!q)
return p;

if (q[1] == ' ')
if (str[0] == '[')
{
q += 2;
/* if there is (EE), ignore it */
if (strncmp(q, "(EE)", 4) == 0)
{
/* if ' ' follows (EE), ignore it too */
return q + (4 + (q[4] == ' '));
}

return q;
char *q = strchr(str, ']');
if (q)
str = q + 1;
}
return p;

if (str[0] == ' ')
++str;

/* if there is (EE), ignore it */
if (strncmp(str, "(EE)", 4) == 0)
/* if ' ' follows (EE), ignore it too */
return str + (4 + (str[4] == ' '));

return str;
}

static char *list2lines(GList *list)
Expand Down

0 comments on commit 0fc265b

Please sign in to comment.