Skip to contentSkip to conversation

libtracefs: Account for events with newlines in print fmt

PATCH In review Steven Rostedt 1 participant 2 messages Feb 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Account for events with newlines in print fmt

From: Steven Rostedt (Google) <[email protected]>

Some events in the kernel have a newline in the print fmt. Even though that really is a bug in the kernel, libtraceevent should also be able to handle it when it does happen.

---

src/event-parse.c +1 -1
index 2b346a5..7a84789 100644
@@ -1248,7 +1248,7 @@ static enum tep_event_type __read_token(char **tok)
 			if (ch == '\\' && last_ch == '\\')
 				last_ch = 0;
 			/* Break out if the file is corrupted and giving non print chars */
-		} while ((ch != quote_ch && isprint(ch)) || last_ch == '\\');
+		} while ((ch != quote_ch && isprint(ch)) || last_ch == '\\' || ch == '\n');
 		/* remove the last quote */
 		i--;
 
#1 lore raw
Quoted 1 line · On Mon, 21 Feb 2022 15:18:28 -0500 Steven Rostedt <[email protected]> wrote:

Subject: [PATCH] libtracefs: Account for events with newlines in print fmt

This was suppose to be libtraceevent not libtracefs.

Will resend :-p

-- Steve