Message ID | 20240221082221.11997-11-stefano.babic@swupdate.org |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show
Return-Path: <swupdate+bncBAABBQXF22XAMGQEWPNY2JY@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=S+TLWRA5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::63f; helo=mail-ej1-x63f.google.com; envelope-from=swupdate+bncbaabbqxf22xamgqewpny2jy@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-ej1-x63f.google.com (mail-ej1-x63f.google.com [IPv6:2a00:1450:4864:20::63f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tfq5M01hZz20RF for <incoming@patchwork.ozlabs.org>; Wed, 21 Feb 2024 19:22:30 +1100 (AEDT) Received: by mail-ej1-x63f.google.com with SMTP id a640c23a62f3a-a3f3c382ba9sf21370666b.2 for <incoming@patchwork.ozlabs.org>; Wed, 21 Feb 2024 00:22:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708503747; cv=pass; d=google.com; s=arc-20160816; b=Xyjxbr0Rm60EhmAt57nSFwLmpsVPZhx8IySwIjumWcit/3S35kSLphAwaOD1Gwcg5F M3AStPmlhUigUgqhgOmT3QIdEBi8+/8AmboFjn3tQyABTmtT/klRdnQdYaXTxCWSO9uc Nq8eYQPPmifg/LM8uwwZmwAc8s+WSVyEJBCn4aRE++dAD+ntRFdxaMULFHcBn+LUYNV7 YhWRB6Si+gM6mAPylXNwKBRURFgiFp63R35Em0eR1DgM6aWXWgmY1i6EE+oZEuF40E3q so4vxkhM0ljAHh8cSlQbC2a9WqxIZxaNiCj7sSaRyhKLcD9rCtF3RHm305nnfUMYm8v5 VXBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:ui-outboundreport:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=MqsjraVN6EbWQhPsDpyms9ZAdh168x6QQZhZf2JGW+Y=; fh=Qy58wvZaopHRpLNZQ/jUkoU6AsXMPi5ZIrP75nxx0Ws=; b=Q+E5dQkd/C70LT3b1iu9G/8DZs3Vpwt6tGRq9kfPxfnPYhy6i/EmDAhophyrO1RNlz hO7b+XlCpIMaKXaIjEx4CGR4YuefJakxZzv3VEQ6bNrN11KWN4QOBUQRnups67g4RSZ6 GS4NctrRvFDQ4IVkpLXODjynh6Lb06IWIBLbxZjZIgRaaxz4ZSqYpukLQxYOjbqHAVx1 8DdbVHWrNC20JnDkQomEMihGE/Gld0k4kR1Ue3lL6+g4yINkFr2fFlyhkSM9H/ovw49L iCmGTjOQvKwNDsQKADjEcwhvApK9FkphBcLNlRb/qcSwzOMVdRfWdO/P1Bxyo6FXwdGF L6nw==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=e+0UpzY2; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1708503747; x=1709108547; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:ui-outboundreport:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=MqsjraVN6EbWQhPsDpyms9ZAdh168x6QQZhZf2JGW+Y=; b=S+TLWRA5TeUg5BQcSv1q8m4U8XZAuLv9oBjhXLste5O2/LqYcrU2//lPQ/6rx8GuOT W1HrkxAtHRFINiaXX/L7cYA1jyM0VbMlbueDjf1las7zx/r40lHupnIQ2i3pT4ha1L9b PKxgTHoYrIZ16N5f39LSVT1oljG9o6uelXSRNeTJOGZlCTXDKCHxKJUHf/fp7VC2oTxa QWc5Bb132zoUx5u5lbtEqtd0lPfXJO5I2RYlYKyTbwdMyAkqflYgxaHhGL1la+kO6eaL /DRS/0Sdu40Bz68zU1oo2xlBuFJkYYRVWQFM/leWsw+Lomt3PDnC2+aslB4To4FFSUwy j2XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708503747; x=1709108547; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :ui-outboundreport:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=MqsjraVN6EbWQhPsDpyms9ZAdh168x6QQZhZf2JGW+Y=; b=dEZ+nA4OazML1XXuy4Y8lgN+VXKRz4p86L1EFOzQCDg6NUkkVcDWf13Gvntzcv+S35 9cjC9yqJ5YAPSetj7Hp9d/A4+hZZpJF25lB8tzLw1NarRAtiQ8ncFEOXa7mL3BbTRmf+ Sv+6Pbalb90QJHPawSDqsfo+NDanr0cpSa90UjFsA7TsU9d3EeYa5YZcpn1U/c3tAVQb Cu2XdnEXgC4a5R/0T58WYR4Z97W4sHW1j8daYbWcemifl0/OlTZ0ZjbEggh4Ot3iH03d 5WBWo/27OKoDbd2dLtUDbrDjNOdzIZztqQ/EBLO4wM6fqI/4Wzc7IND7lRX//tg+vGSk ZHgQ== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWQ5CCXMRGP58E6XSngDCaHb0++3RyBOco80ytT98FtCq9cEzhEhcVnnIlspGvNEK52tnHg17XiofBfo483n7F72J0IKSdJYG7ElZ03bQ== X-Gm-Message-State: AOJu0YzEmRWKUoEq0vJkUBfC/nsd+qxujzo4ItbfyrS0M9uJ6oi/zdMG p0/Zr2XMnyP6+pTg3OQahfGMI9rH+VbKGKiznmy8h/z2teo21Sre X-Google-Smtp-Source: AGHT+IEvQHpRU+u2i9ak3yWUW4/Yb1BKCzMJ8DSVwhrIkXB+/25oeXSAOEVTO1yT5TaVeY4vTg2p9A== X-Received: by 2002:a17:906:b0d9:b0:a38:63d4:2273 with SMTP id bk25-20020a170906b0d900b00a3863d42273mr12445879ejb.35.1708503747101; Wed, 21 Feb 2024 00:22:27 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6402:4494:b0:564:84d0:f1cb with SMTP id er20-20020a056402449400b0056484d0f1cbls117524edb.0.-pod-prod-06-eu; Wed, 21 Feb 2024 00:22:25 -0800 (PST) X-Received: by 2002:a17:906:d285:b0:a3f:4b56:b9ab with SMTP id ay5-20020a170906d28500b00a3f4b56b9abmr388494ejb.8.1708503745534; Wed, 21 Feb 2024 00:22:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708503745; cv=none; d=google.com; s=arc-20160816; b=jRcT8/6CsqtLc5vElvYUFK6aUofAk0ef+undiSDSsVrZ6wGyiY5aJq0MiwCDFC9TbR Ls0LM+i+/8IxUUR5HlOSJstyjCCayhFdj25vBU6BX/e9zYzl5zZGwTOmKa6UWmgXeHJS XwyPZh+9CPH4Pr+7yQlRgUmLLlz/BIj0R3J/QWBxo2edNq+zITHvU8DxAAlvnKz6QyCD WufdiAatsqgJHs7FX7wfl0+TE/HVffYeSTOR9rCCpVqCf/qS4QEnfv2XHO23yTx7wach DDrUaQZg5yyvoiSboXlAo+EOZpfJSwgTpzjFYBiiUC0IQGCkJvUbk4QS9s4HMH/XFPbK Iy3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=h9zma5dTn1xIJiHsMtkg3SzTq6b1e4bpwbte5GZXOq4=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=l+P/YOgGHc5syMZ9UAY3q7jYegH8xvagKhitOpFzLrJkP9cE7kiGE0Qc8lvU5rg+Fu qtoqpXJzStf7Y+S8CRNUw5vKHonp69UVN7o3IsEXJQyaUJzDazVsvIR13H/5dUrsLWB6 xaO6bhPfVkdBA61eQwaXuznslIni4WxV8OpsPyj248Qub/6fPDM7/vc4hI+E3Vq7xYzv umFVs+l5+bO30dLPAVCAv8aL/2Deq2nrx9s4asYo3aibFtXdKnoNsyNvR1+Cz+fOABho dSCuGEBvyzqUyuqD3oBvv70guFbscioLHpHIHU7D+EpaB0zBJcsrb2Ig+97phDpr/8Uv nzVA==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=e+0UpzY2; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.131]) by gmr-mx.google.com with ESMTPS id p1-20020a05600c1d8100b0040ff8f0e6acsi55640wms.0.2024.02.21.00.22.25 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 00:22:25 -0800 (PST) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) client-ip=212.227.126.131; X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MeToK-1r2H7l0Kc0-00aVTK; Wed, 21 Feb 2024 09:22:25 +0100 From: Stefano Babic <stefano.babic@swupdate.org> To: swupdate@googlegroups.com Cc: Stefano Babic <stefano.babic@swupdate.org> Subject: [swupdate] [PATCH 10/13] run_lua_script: check input parms Date: Wed, 21 Feb 2024 09:22:18 +0100 Message-Id: <20240221082221.11997-11-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240221082221.11997-1-stefano.babic@swupdate.org> References: <20240221082221.11997-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:MK3d+UfLqYyx3wteZQrnZ+Io5W+p40aR/l/Yk0FRgWe9ybFomWR 2KFNefarvoVq9QJ0kqex+uttK99+XNPju8CnYovdF4q70P6GYSr3mb4RcMk04rDCR4XM7WL 7HUTGeGAwb29HL+TxnoPv54rc84auxwXYRf31HVDUvp0f63bDcMJJKAKX1VmvYR+Q0+d05s TefibmRmXBydNhyn1oXFA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:yW8ra3w74Y4=;K2KvSea8aowNZByMAcJ5B3VNQ5e 0hfehWPvt9XTIB7LVROMRK6DyAkb0uht2pr9OyUKO4dB8vs/nBR1zwyBliNKC0Gt22C3XAXD7 CvO0PxoOBg2UdeD9vCG/GvcD5vYtiA/c2k7s/H6hu2IFcq8H+yH1KaE8n0XdHxbPFSrUWRbtW 2G1TVf8WJJRH99iTRPPeWI2X5mtawLqVeCR6r7GnLrlAQM8XKyBDEYyyogMTDSAk232jFANm0 hrVD3UBMiNRl+8SlR72eTjl6/uXmR98PDEP/FYI9dR8ahpR0OEmnNELg/AKkvWfvq/AN7Zm+U cXMYN2mXowA4Hh2P5NpsF/IMDv7Ffw/4b/RY4mWyrfifx3HfNrK75g2Aq5BcL+eIKAWXrWtcb xjKHX1mvZFAlt4Yii2Arvvv3vyU+nn4kaLZ/jlIYPHjUnhLINYHwsRM6Xe0kwe3EJhmZHKhyn w1IL2wKDgbh3rzT+Y22uyuvu3rhHwNJY5ADWCRHTOwTk0KiPIZ6Al4KbdQpoq6wOOv0IlXVZZ rgc1spBmTs/tlW80voFtw1OxlVwMjsVkXw/Keh3yftYONDaPv1MvNIwR0J3d1bHJFZyGXOSLC FoyjbA/PiD9kQ9PaOt0otHy73ZQ8ZZqj9NBOFU0cyNjkEZs4bOjFB1jwFcVI6o6k4jRG/gjVY 1tN5naV9t3vK+S829ePno1uXOFGRJCPQqso4Qeg2JR4BqcpWHEecU5qTcO5nEvW6x0SxhPzz1 dC8Qx3ZFkz5rtrrWKvb5asS76JmXES+2MkEOQB7PUX4PRihWPvsqus= X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=e+0UpzY2; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
Extend Lua Environemnt and post-failure scripts
|
expand
|
diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index 72190383..78e27576 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -209,9 +209,14 @@ int run_lua_script(lua_State *L, const char *script, const char *function, char int ret; const char *output; - if (luaL_loadfile(L, script)) { - ERROR("ERROR loading %s", script); - return -1; + if (!function || !L) + return -EINVAL; + + if (script) { + if (luaL_loadfile(L, script)) { + ERROR("ERROR loading %s", script); + return -1; + } } ret = lua_pcall(L, 0, 0, 0);
Moving the Lua state outside the function, parameters must be checked for consistency. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- corelib/lua_interface.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.34.1