mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	lkml <linux-kernel@vger.kernel.org>
Cc: John Kacur <jkacur@redhat.com>
Subject: [PATCH] trace-cmd: Fix segmentation fault in trace-snapshot
Date: Tue, 21 Mar 2017 17:11:53 +0100	[thread overview]
Message-ID: <1490112713-9456-1-git-send-email-jkacur@redhat.com> (raw)

To reproduce the problem:

  plugin 'wakeup'
trace-cmd: Device or resource busy
  Segmentation fault (core dumped)

When the user triggers a condition such as EBUSY the program should die
gracefully. The problem here is simply caused by an extra conversion
specifier in "die" in the write_file function

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 trace-snapshot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/trace-snapshot.c b/trace-snapshot.c
index 9d3608c49563..771b065ccfa4 100644
--- a/trace-snapshot.c
+++ b/trace-snapshot.c
@@ -42,7 +42,8 @@ static void write_file(const char *name, char *val)
 
 	n = write(fd, val, strlen(val));
 	if (n < 0)
-		die("failed to write '%d' to %s\n", path);
+		die("failed to write to %s\n", path);
+
 	tracecmd_put_tracing_file(path);
 	close(fd);
 }
-- 
2.5.5

             reply	other threads:[~2017-03-21 16:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 16:11 John Kacur [this message]
2017-03-21 18:35 ` Steven Rostedt

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=1490112713-9456-1-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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

all inboxes | Powered by JetHome®