diff mbox series

trace-cmd: Parse command lines with spaces

Message ID 20201117112210.207985-1-tz.stoyanov@gmail.com (mailing list archive)
State Accepted
Commit 9836b7811458ae4781f76297342f544a38041237
Headers show
Series trace-cmd: Parse command lines with spaces | expand

Commit Message

Tzvetomir Stoyanov (VMware) Nov. 17, 2020, 11:22 a.m. UTC
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
Reported-by: Douglas RAILLARD <douglas.raillard@arm.com>
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 lib/trace-cmd/trace-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c
index 0ead96ea..bd09882b 100644
--- a/lib/trace-cmd/trace-util.c
+++ b/lib/trace-cmd/trace-util.c
@@ -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);