diff mbox series

trace-cmd: Fix left open file descriptor in recording of date

Message ID 20181205223809.036f3950@vmware.local.home (mailing list archive)
State Accepted
Commit 6cb0b60fd5e8365d18c58bfe3787a91d93661271
Headers show
Series trace-cmd: Fix left open file descriptor in recording of date | expand

Commit Message

Steven Rostedt Dec. 6, 2018, 3:38 a.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

When running the --date option of trace-cmd record it loops through
writing to the trace_marker and reading the timestamp from
trace_pipe_raw. But it never closes the file descriptor it used to open
trace_pipe_raw with. This prevents other parts of trace-cmd from working
like writing "function" into current_tracer, because the trace_pipe_raw will
hold a ref count and not let different tracers be set if that file is open.

Fixes: e09a5db1a ("trace-cmd: Add trace-cmd record --date option")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 038b2313..24580a40 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3421,6 +3421,7 @@  static unsigned long long find_time_stamp(struct tep_handle *pevent)
 			if (ts)
 				break;
 		} while (r > 0);
+		close(fd);
 		if (ts)
 			break;
 	}