diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-03-03 16:40:00 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-03-03 16:40:00 -0500 |
commit | dd08a70a9f50ae01748c0b09e0f68ea793f0f3a6 (patch) | |
tree | 6b25bb806a071ede01be82cfc3995962fd7be8af | |
parent | 80e0863e9bd35c61ce42716a0839fde0796326f6 (diff) |
trace-cmd: Don't crash on printk format errors
For some reason the trace-cmd split caused the printk format to
have lonely ":" on the line which caused the parsing to break.
Just warn instead of crashing.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-util.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/trace-util.c b/trace-util.c index 6854977..4a97ff0 100644 --- a/trace-util.c +++ b/trace-util.c | |||
@@ -169,6 +169,10 @@ void parse_ftrace_printk(char *file, unsigned int size __unused) | |||
169 | line = strtok_r(file, "\n", &next); | 169 | line = strtok_r(file, "\n", &next); |
170 | while (line) { | 170 | while (line) { |
171 | addr_str = strtok_r(line, ":", &fmt); | 171 | addr_str = strtok_r(line, ":", &fmt); |
172 | if (!addr_str) { | ||
173 | warning("printk format with empty entry"); | ||
174 | break; | ||
175 | } | ||
172 | addr = strtoull(addr_str, NULL, 16); | 176 | addr = strtoull(addr_str, NULL, 16); |
173 | /* fmt still has a space, skip it */ | 177 | /* fmt still has a space, skip it */ |
174 | printk = strdup(fmt+1); | 178 | printk = strdup(fmt+1); |