From patchwork Thu Dec 6 03:38:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 10760137 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:59262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727695AbeLFDiM (ORCPT ); Wed, 5 Dec 2018 22:38:12 -0500 Date: Wed, 5 Dec 2018 22:38:09 -0500 From: Steven Rostedt To: "linux-trace-devel@vger.kernel.org" Cc: Tzvetomir Stoyanov , Slavomir Kaslev , Yordan Karadzhov Subject: [PATCH] trace-cmd: Fix left open file descriptor in recording of date Message-ID: <20181205223809.036f3950@vmware.local.home> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: From: "Steven Rostedt (VMware)" 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) --- tracecmd/trace-record.c | 1 + 1 file changed, 1 insertion(+) 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; }