Linux-Trace-Devel Archive on
 help / color / Atom feed
From: "Tzvetomir Stoyanov (VMware)" <>
Subject: [PATCH 1/3] trace-cmd: Fix check for trigger file in create_event()
Date: Wed, 25 Mar 2020 16:08:27 +0200
Message-ID: <> (raw)
In-Reply-To: <>

When a trigger is configured on an event with trace-cmd "-R"
option there is a check in create_event() if the trigger file
exist, using the stat() call. It returns 0 if the file exists
or -1 in case of an error. The check of the stat()'s return code
is for positive number, which is always false and errors are never

Signed-off-by: Tzvetomir Stoyanov (VMware) <>
 tracecmd/trace-record.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index c8c853f8..ec3bcae9 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -2707,7 +2707,7 @@ create_event(struct buffer_instance *instance, char *path, struct event_list *ol
 		if (ret < 0)
 			die("Failed to allocate trigger path for %s", path);
 		ret = stat(p, &st);
-		if (ret > 0)
+		if (ret < 0)
 			die("trigger specified but not supported by this kernel");
 		event->trigger_file = p;

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25 14:08 [PATCH 0/3] Fix applying triggers to multiple events Tzvetomir Stoyanov (VMware)
2020-03-25 14:08 ` Tzvetomir Stoyanov (VMware) [this message]
2020-03-25 14:08 ` [PATCH 2/3] trace-cmd: Fix double free error when triggers are configured on " Tzvetomir Stoyanov (VMware)
2020-03-25 14:08 ` [PATCH 3/3] trace-cmd: Fix setting triggers to all events from given system Tzvetomir Stoyanov (VMware)

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:

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

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Trace-Devel Archive on

Archives are clonable:
	git clone --mirror linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ \
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone