Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938183AbdD0Crc (ORCPT ); Wed, 26 Apr 2017 22:47:32 -0400 Received: from smtprelay0249.hostedemail.com ([216.40.44.249]:45151 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1033620AbdD0CrZ (ORCPT ); Wed, 26 Apr 2017 22:47:25 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::,RULES_HIT:41:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1434:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3280:3352:3622:3867:3872:3874:4321:4385:5007:6261:7514:7875:8957:10004:10400:10848:10967:11026:11232:11473:11658:11914:12438:12555:12679:12740:12760:12895:13069:13311:13357:13439:14181:14659:14721:21080:21451:30029:30046:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:6,LUA_SUMMARY:none X-HE-Tag: cry44_23797a8337814 X-Filterd-Recvd-Size: 2075 Date: Wed, 26 Apr 2017 22:47:20 -0400 From: Steven Rostedt To: Taeung Song Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] plugin python: Adjust the handling after PyRun_String() failed Message-ID: <20170426224720.58733a9a@grimm.local.home> In-Reply-To: <1493250381-25278-1-git-send-email-treeze.taeung@gmail.com> References: <1493250381-25278-1-git-send-email-treeze.taeung@gmail.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1191 Lines: 48 On Thu, 27 Apr 2017 08:46:21 +0900 Taeung Song wrote: > 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; Hmm, we can either reuse err. > 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; or do a: return res ? 0 : -1; -- Steve > } > > int PEVENT_PLUGIN_LOADER(struct pevent *pevent)