Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033042AbdDZXqi (ORCPT ); Wed, 26 Apr 2017 19:46:38 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:35666 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033024AbdDZXqa (ORCPT ); Wed, 26 Apr 2017 19:46:30 -0400 From: Taeung Song To: Steven Rostedt 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 Message-Id: <1493250381-25278-1-git-send-email-treeze.taeung@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 972 Lines: 39 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 --- 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