Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933209AbdCUQMQ (ORCPT ); Tue, 21 Mar 2017 12:12:16 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33456 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932848AbdCUQMO (ORCPT ); Tue, 21 Mar 2017 12:12:14 -0400 From: John Kacur To: Steven Rostedt , lkml Cc: John Kacur Subject: [PATCH] trace-cmd: Fix segmentation fault in trace-snapshot Date: Tue, 21 Mar 2017 17:11:53 +0100 Message-Id: <1490112713-9456-1-git-send-email-jkacur@redhat.com> X-Mailer: git-send-email 2.5.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 834 Lines: 31 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 --- 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