Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631801

[PATCH] plugin python: Adjust the handling after PyRun_String() failed

From Taeung Song <treeze.taeung@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] plugin python: Adjust the handling after PyRun_String() failed
Date 2017-04-27 01:50 +0200
Message-ID <tAER3-QX-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] plugin python: Adjust the handling after PyRun_String() failed Taeung Song <treeze.taeung@gmail.com> - 2017-04-27 01:50 +0200
  Re: [PATCH] plugin python: Adjust the handling after PyRun_String()  failed Steven Rostedt <rostedt@goodmis.org> - 2017-04-27 04:50 +0200
    Re: [PATCH] plugin python: Adjust the handling after PyRun_String()  failed Taeung Song <treeze.taeung@gmail.com> - 2017-04-27 05:00 +0200
      Re: [PATCH] plugin python: Adjust the handling after PyRun_String()  failed Steven Rostedt <rostedt@goodmis.org> - 2017-04-27 13:40 +0200
        Re: [PATCH] plugin python: Adjust the handling after PyRun_String()  failed Taeung Song <treeze.taeung@gmail.com> - 2017-04-27 15:00 +0200

csiph-web