Skip to contentSkip to conversation

trace-cmd: Parse command lines with spaces

PATCH New Tzvetomir Stoyanov (VMware) 1 participant 1 message Nov 17, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: Parse command lines with spaces

If a command line, saved in the trace.dat file, has spaces - it is not parsed correctly by trace-cmd. Parsing is improved, so command lines with spaces are displayed correctly.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=210193

---
 lib/trace-cmd/trace-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/trace-cmd/trace-util.c +1 -1
index 0ead96ea..bd09882b 100644
@@ -63,7 +63,7 @@ void tracecmd_parse_cmdlines(struct tep_handle *pevent,
 
 	line = strtok_r(file, "\n", &next);
 	while (line) {
-		sscanf(line, "%d %ms", &pid, &comm);
+		sscanf(line, "%d %m[^\n]s", &pid, &comm);
 		tep_register_comm(pevent, comm, pid);
 		free(comm);
 		line = strtok_r(NULL, "\n", &next);
Signature · 1 line
2.28.0