Skip to contentSkip to conversation

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

PATCH New Steven Rostedt 1 participant 1 message Dec 6, 2018

lore
Share & tools
lore
#0 lore raw

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

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

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")
---
 tracecmd/trace-record.c | 1 +
 1 file changed, 1 insertion(+)
tracecmd/trace-record.c +1 -0
index 038b2313..24580a40 100644
@@ -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;
 	}
Signature · 1 line
2.19.2