mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Taeung Song <treeze.taeung@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] plugin python: Adjust the handling after PyRun_String() failed
Date: Thu, 27 Apr 2017 08:46:21 +0900	[thread overview]
Message-ID: <1493250381-25278-1-git-send-email-treeze.taeung@gmail.com> (raw)

Even though PyRun_String() failed,
just 0 will be returned but we need to return -1
that means error status, so fix it.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 plugin_python.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugin_python.c b/plugin_python.c
index 2997679..dcfad0f 100644
--- a/plugin_python.c
+++ b/plugin_python.c
@@ -24,7 +24,7 @@ static int load_plugin(struct pevent *pevent, const char *path,
 			const char *name, void *data)
 {
 	PyObject *globals = data;
-	int err;
+	int err, ret = 0;
 	int len = strlen(path) + strlen(name) + 2;
 	int nlen = strlen(name) + 1;
 	char *full = malloc(len);
@@ -50,12 +50,13 @@ static int load_plugin(struct pevent *pevent, const char *path,
 	if (!res) {
 		fprintf(stderr, "failed loading %s\n", full);
 		PyErr_Print();
+		ret = -1;
 	} else
 		Py_DECREF(res);
 
 	free(load);
 
-	return 0;
+	return ret;
 }
 
 int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
-- 
2.7.4

             reply	other threads:[~2017-04-26 23:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26 23:46 Taeung Song [this message]
2017-04-27  2:47 ` Steven Rostedt
2017-04-27  2:52   ` Taeung Song
2017-04-27 11:30     ` Steven Rostedt
2017-04-27 12:57       ` Taeung Song

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=1493250381-25278-1-git-send-email-treeze.taeung@gmail.com \
    --to=treeze.taeung@gmail.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®