linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>,
	Slavomir Kaslev <kaslevs@vmware.com>,
	Yordan Karadzhov <y.karadz@gmail.com>
Subject: [PATCH] trace-cmd: Fix left open file descriptor in recording of date
Date: Wed, 5 Dec 2018 22:38:09 -0500	[thread overview]
Message-ID: <20181205223809.036f3950@vmware.local.home> (raw)

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 --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;
 	}
-- 
2.19.2

                 reply	other threads:[~2018-12-06  3:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181205223809.036f3950@vmware.local.home \
    --to=rostedt@goodmis.org \
    --cc=kaslevs@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tstoyanov@vmware.com \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).