From patchwork Wed May 17 15:35:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 1782745 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43e; helo=mail-wr1-x43e.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbwxisorqmgqeufww4ba@googlegroups.com; receiver=) 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=20221208 header.b=aWjwaXhU; dkim-atps=neutral Received: from mail-wr1-x43e.google.com (mail-wr1-x43e.google.com [IPv6:2a00:1450:4864:20::43e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QLxyk28Khz20KF for ; Thu, 18 May 2023 01:35:58 +1000 (AEST) Received: by mail-wr1-x43e.google.com with SMTP id ffacd0b85a97d-30641258c9esf382304f8f.2 for ; Wed, 17 May 2023 08:35:57 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1684337755; cv=pass; d=google.com; s=arc-20160816; b=dPlp/PaD8DbxnZRfPP9s3+t0iv5p0rTj/ksgQqz1ITHYNPWIECZ7Zlr15GJWgIi/X+ OLVFpSWQS63Apw498Ei9nPY+YoN19hoNBUqaM5aGUhg8hO6f9+DTn1C9N+N1J1aUVW1b r89LxqiZvIBW01xZJSRNyzY7JDJzNetdhHTj+m2aWg8CpRHLmDOqSVRgfkwOuYz1xRgq U/idH5tfQUuzJD8zcV4C7SxK++ZZE4StrMiaxOcgv9rZgdIVeB98jZDJ0oJASchINvEM 1havTAfloPOoLAwJQy5/XsxzCsNrDW5rMMVZXfnRy2mqN3MYsK+wpTIWlzFZZjMMcvgB nVDQ== ARC-Message-Signature: i=3; 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:reply-to:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=MM2bNNlcAmjYcc2lBUFwOHQ2Mr2rTbZ93o4dsDWGrs8=; b=EziUreAvFQshNmDaglfwzQmZDMjf2conSPZk5abk4vL8hfV7qVI8efDAbatZuzFc/h MEHWL1HWjW67BQtBa+Pq53eqeso3B7+jKDY9/MGlV0RD4zMWpSAwRmqB0jS4X7xTOXuv Aamo63EhGpXaxMYFn6uLdI04v2NsM0Zy+XW5oVKdaW1AyHf0WAQ4UDo+cL+wpsuEwS4W Lh0g2SnxI/yJcNnM41256fmfZr+mwbbkd3wxIw6c9zgHVQL/htd9Kx+eE6k8APqUuGAF a8KhObSadB+qD7pO3RYutToid1ZBj0Wy8y6XDKe6I5mB1FCGL76WDSigwpWLR4lYl7zK vO2Q== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=QMn5EkJf; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 2a01:111:f400:7e1b::626 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1684337755; x=1686929755; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=MM2bNNlcAmjYcc2lBUFwOHQ2Mr2rTbZ93o4dsDWGrs8=; b=aWjwaXhU//j2SQw3C7gX/edhqGz1I9BkiRHtiqs+MwR4QHJAEVsQ2dPB2NippRhhS3 IyMR8t1LXQAcdeJdogI4r9fVcamof79nr8tNnZW4qLVhZvesmJ0h1qQSmrFOB5/tNA4p HAN++Lr2LjO82Zj17HEPHQJQRWArvF6xS+6wKnW+/3QWH5xoZiyT62ruKlfiykABtfAb pTI4jF63/0EiipMa5dRqLiXBOYcvXA3B7R0fdVcHXsX0EtF9v3ZYHGQUgQf3scTBBoL1 +2xbgDGH8dc5Y+XcEV3J8UEmr5J/CzOQ7kn70OIVtPTHleR8G7CmonYI2XywF5gcts+M Mkpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684337755; x=1686929755; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MM2bNNlcAmjYcc2lBUFwOHQ2Mr2rTbZ93o4dsDWGrs8=; b=U7B1wwkKxvoBkKpgUPIC068vw2BddO24wQx/wnR130qDVjLsm87IjnpAW4rU3Y8iQ5 TwmyIu0qE9srHZiCBeAuBKCVhjrdFylH6SwWav/I5PlWtxNPxeHY20PAOX0xi496Fc6T KfqYOXpeLwmN4PFEQZdf8p/RThWs7eTMz1Blbro/oxBDc++SifeMopv+ViuJPcGnMPms g94O7WWAfPAu41lRRM0mgmKYFYN9tuDw4BdS1vU2A3wZAjP0TPLOHq+XuxKFfosOSPxd Hx4hgljnkfZHDYcD4sQ36CowM85pPP4SK+E/Qh8QtlmoAw8mrh6ZgityGWtGmWVeYzIk q6gg== X-Gm-Message-State: AC+VfDyL3NKnWtUSmXYjAgWwnCsGXHeSbj9P1ZDepQ36jKhDGQMFQuat hYXKgymPPaBixOD+HxhhehQ= X-Google-Smtp-Source: ACHHUZ4nJRGvt4RvALMb2JcG/kTZ/DtRDMTraBdNGBFpfLp3a8G4FybVYTA8wmS7VD1wqOTwdFUSSA== X-Received: by 2002:adf:eec5:0:b0:309:38af:91c4 with SMTP id a5-20020adfeec5000000b0030938af91c4mr198209wrp.6.1684337754912; Wed, 17 May 2023 08:35:54 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:600c:45c4:b0:3f0:b128:14c0 with SMTP id s4-20020a05600c45c400b003f0b12814c0ls1586262wmo.2.-pod-control-gmail; Wed, 17 May 2023 08:35:53 -0700 (PDT) X-Received: by 2002:a1c:f209:0:b0:3f1:92aa:4eb8 with SMTP id s9-20020a1cf209000000b003f192aa4eb8mr27304883wmc.16.1684337753301; Wed, 17 May 2023 08:35:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684337753; cv=pass; d=google.com; s=arc-20160816; b=jjbKo9GlV2mPV8nrzoob16IAN8zMEEk8PPXvlqQgegT+qYwo5haKPSJcCDighYZEjt 9SfAVcXhvWIjQMmDRHmPfU8SmSaSfVRuI4wuotY3brsQq9xgIK93Wec2GMwMJbOXC6cj GI0I9JLB4SCyQ94t+L9Zc0Auf21pyL/gHMDwGllUThp6bPboZLBfrq3h5UH7iIzCNF60 NWUsou6jTFLBbpRVV1At57wDRxfzX/2O+o5JvmElBwS+LXqI8Q0Gfk42j01ThBXUpO0y MvvcVUv47q91Uw5wP20+LHz4jLHQKJvLEqbMXro4dtPXOTVNyPC9sSjXoRJTAHhHtLaG ZmDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=yi4ILqWLdvdWZKVqGlWD99EEqIgfMpvM/tmCeSeXCOE=; b=FOgzbHtPvBHoo2qi8Q5/YDtVaUnXJb90/z6RCe/aIL0YJ39VDfS6ClJN3QBnEf55yP 3v6/vb0a7Iy6jLNuoop/1FU/Wu7PyhsJbvLBI9kmoPHM4dBxK5XqRxgB8KiAbmWe+uEP jIuoeVkPdK3abqKyoKjHFTHpZQOz8nZFAA1cWTVHuayNUnmQRBpi+XJquXqF1DCg3dBt eh3ywQBueuJQaNkNE6BtF/2t+ZPdL47WMQsRlDUYAJwrNhx2tW4s6uodsjvibkLJy77+ 8jc6G00KPylsZjY9o/qqig6+r+QAgy1CysjyvZcxHFV6bAo/KOZ+7JPSrUTsSN6ammtn 8VVQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=QMn5EkJf; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 2a01:111:f400:7e1b::626 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20626.outbound.protection.outlook.com. [2a01:111:f400:7e1b::626]) by gmr-mx.google.com with ESMTPS id e11-20020a05600c4e4b00b003f4276a712bsi119890wmq.1.2023.05.17.08.35.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 May 2023 08:35:53 -0700 (PDT) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 2a01:111:f400:7e1b::626 as permitted sender) client-ip=2a01:111:f400:7e1b::626; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kDSsebB/pvRGpb/kba5R/jSdjQZ+q5igZ7KXhGCV10K5YwrSw/sn63gdVslYjRzI+9z7seWMvRxCk/rg8dKCD4iU9ZSHJfsAm4pEpgh5NwT4i3+YQ+kXkaUWHZztw2ewQ0q2pG8AVK94dLhSph2p/MkSINirj2kmLzHm4ZdHdvTAj85ZNYmQEcAs49ZbhH+q5lNOmA0nKHMuCIMcw4ytdnRawT21Lxlo0jVKm5GaztMUcjpOcrNk+7nvX4QkPcUUXNG5Rki+Z70po70HgM1tqkn1eNuHSItKLnlOBsaln8XqYlUjHoHhQIhsWj5uNYKrC4VwFVElkZEA4pVNx9Vssw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yi4ILqWLdvdWZKVqGlWD99EEqIgfMpvM/tmCeSeXCOE=; b=k7FNn4vGl5cly3Pp6c63roz9fl4hb4lVUyLJf3ar4WgrcvuB/V1LFkirmsgBMsjoTk2Fq6hnMoFszL6NoEJ+FMywo8LAqoF3wSuRwDq9+MKgwC1M9tyrWoQh1fPhcFq51/ARzdjjQvoV1FXmaY8ikdi392H0IugeeDYg4AOkVrZCvzEwhxlcTUhM1pWqeEPpcXC17oym2DUX0DUNRI81QqgEeIquJ+0UQEt8m6TuC2znA3KyqgAfQrMPa2sJY75W/QH6boJiW2PWpiQvoKU21+rTJ9HJ78jiGR4AYoOan3e+dAFLVMHn+glW9WYj12ppQyfIyW5vCCBXcg/8G9yCGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siemens.com; dmarc=pass action=none header.from=siemens.com; dkim=pass header.d=siemens.com; arc=none Received: from DB9PR10MB5404.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:333::17) by AS8PR10MB7972.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:567::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.32; Wed, 17 May 2023 15:35:52 +0000 Received: from DB9PR10MB5404.EURPRD10.PROD.OUTLOOK.COM ([fe80::6bed:3b93:4756:c9f3]) by DB9PR10MB5404.EURPRD10.PROD.OUTLOOK.COM ([fe80::6bed:3b93:4756:c9f3%5]) with mapi id 15.20.6387.032; Wed, 17 May 2023 15:35:52 +0000 X-Patchwork-Original-From: "'Christian Storm' via swupdate" From: "Storm, Christian" To: swupdate@googlegroups.com Cc: Christian Storm Subject: [swupdate] [PATCH 3/3] suricatta/lua: Return STATE_ERROR instead of nil on !pstate.get() Date: Wed, 17 May 2023 17:35:50 +0200 Message-Id: <20230517153550.262808-3-christian.storm@siemens.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230517153550.262808-1-christian.storm@siemens.com> References: <20230517153550.262808-1-christian.storm@siemens.com> X-ClientProxiedBy: FR0P281CA0231.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b2::11) To DB9PR10MB5404.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:333::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB5404:EE_|AS8PR10MB7972:EE_ X-MS-Office365-Filtering-Correlation-Id: 82b84571-5f16-47d7-6389-08db56ec6591 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VToMLttWO5XL7VtwCu8Ah7A+3znKe+dRrczkTeeruj1upoN/vISxK/00JrwxH0YOnq+8huA8oR9RiabwRDfjQTqBqZqtC9BDA0WiZnoZs+KFUaNqSVWlCVOvkAJtZ2bQS8hrR0ZF84JOwPtX6Bc5R1ovDsAzWta5JvMIFy6m3pSx2U7bb+OaeBmAHEdnzDoMIJ7toX+NG/VtYHtIp60S2JdYfZYodJapVhtN3N6J5HxNYoh7jZuNQMZOpv2/nvusofuMLYmITAwUPKifW4xVRqaePkHIijQWdeTMAO0MsgTpL0+iLJIlUJco9H9OiT0C3MotmqxuNNZ56M4KsfsjVdaiHoUs8CVSaI/ySRaabp8HgPOOtCYQhHwynGm6tg+h3ge9WpjJGsqEyHlM8BGm2qDx7K7bp3Te2dt7Zoiq+WlqacPHD+Ou0IcskBRAGvNP25cc1p0VmD8FvYODl9mziyB0M5sfLfVh8KSmDnhhzf5bioEgkWk6shCMXRlvLMnXY2V+apNf81/5Dfzu3KZYrDArLUKeIegl5tBIDICj75Caqk0/BpObV7mdDVUUQ8mU X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR10MB5404.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(366004)(39860400002)(376002)(346002)(396003)(451199021)(86362001)(36756003)(6486002)(4326008)(478600001)(66946007)(66476007)(66556008)(6916009)(316002)(5660300002)(2906002)(8936002)(41300700001)(8676002)(44832011)(38100700002)(82960400001)(6506007)(1076003)(6512007)(186003)(2616005)(107886003)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WSYhS9VLLLWJZS4ESxeucx+f2X1/sgN/jmrxGa2SgQfuLPUOhTZq4nsPHrhLJZQMf0WWQk64JppG2A1Ry80zViXWJseLWylBSWTufsFipAenuy7lb+xkUmTiOwZQRYx2SnSqOd5YHnnFJs7nbeq1m7b+1mMbJWPU8cpGypIIrX+O9rcxbEGDCAl7r1NAx3jUDl9o9otuBEYwRZhNb3Ov6T9/9h0IAvmNr7Ldj/NGqte/vC2z2VkJtxK/h3lw5tL7IWTtKe+RbnMpRbpFQkeMSUj91ToPpqUDhlHd3CAFXXG8tTfoEwYbEiVSrbCw/JLeRVynPJzk/UPzKqT6W9wtCYUry8BQ987tbHM3cbLvrdWpY4yVhajqxEMqB5A1tEu/qfEPoRLfaVsbsUtzU9OsavJGvSdqpTg2P/OSuVOnEAjBfX4C5l1SvZq50QHVhrW/cME4Qo9Uq7S/+IAoLuPCn+iKtvs2YJbR05lU2C+XHGHhGCzseVWqXHOI/Wbfg9ijlCSfKyyT6iA46A906O1BIPjDlFDvzBdJQy+cJM8X91mzDRQgJUvwCHUVr4wjUfIzBhkHkTOHc4jL18GjDYfON2YaH8ZfPMHRattPQfATxy2PtjnYo8UCBjjZDormJ0aLDKZZcYwiA8bs7hwMiOeaMvYVyPvgAojccTQjiL7qhZHYnO5umJQ5kFqONvAvq5J9hjlkaKea5GSW7cxyvc4ne0o7eGbEv9YjArRkcKBtK/tKUnKgo3X3DTCuRfcgIKg/QGtgSzGwQTTPByaF2w9MUYpqQVo/lMXTVjlz0iP0YYZRiBUkJBkajyIbUoyIQyj4pEtdaTGy4atdv6u29kenf3xnvS4QTUPbZ+RSNZVdRVAET8P/48KwwyEnzd3mmI57M7DBUXOB/Dj76gw1AzTzpfMYxoWdGxb5qV5HA6Ykp7uFjEsc2IGvo+tDOva9OnKhmlWjSDUM8PzUfi/qoiphs3Tg3DZWDUyLsw2ccL1m57eMvTNExhwqMLxJy4QEXfgMJoEOt2Y4jG2+82un0KguAig59eQst1jmUK6M/2d5vzA0f3V5XGIp7UXcQs8+S0aremtG0ewHrIEigbw2lpZeUWoVPDk/IYk4F7GLhPolU4kD5cdwbwNHf2cL4TuquVIithxAgNNIO3arq2lnDQGNGzSOWH4I/caazcPidE4CjDe5wJWX8yX+nGnfBW1C8B3woU8T2y1HQVAN0ODV3+QZ3+pQyXDBxwrXfMVwnaYWLHhGL/Yx3lI2M69sPHgvwAtv6t36o6aytlVHOf6vAXUlv8oYLQsHMlJI3oQ3DRQqse+LtwcUEIJoOd4l1l6NFkYx+RwVaf56hP/YuPMzI3p++L8ZceRDEaYp8YpgUQoSHl2i+oc+2XAMpBsm7yL0eRZ9px1Cn2+4bLl6N/K8CQhyaaZMRCYC7HaN/PCULY/OtJz4gN77MCYSJKWvgaP6i7Ggg11okJ0MVBCmOOy91rkmu3dvr6xFbysB9QgjuPZyAfQN8+fsF4SSZgSAcV1XJMtvSzNpxF4CQzYUbkk4GK0OMiVrB48OMwvv7WqbB3hi5dMnmS/xbyCH7QH0BAvG7UznyH85woZ33Lr6m8nkr4zpUqtdcXzzHwKPBeTR12CN8KkY8yqWh7ku+gyd/hNDb4VIA5b1X7LbgljVYJbZTJPkMw== X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82b84571-5f16-47d7-6389-08db56ec6591 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB5404.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 15:35:52.2568 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: myRK8HwEVmq3azBLRhIRcIf3J0isHgOCiQgEabwEYH0qI082J8teqg//VaSdPouMogFwsd+pq91WgCbHETV1+cSclEDLvcFvXwY3qfeTNTg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR10MB7972 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=QMn5EkJf; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 2a01:111:f400:7e1b::626 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Christian Storm Reply-To: Christian Storm Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , As nil is not of type number and STATE_ERROR is semantically equivalent, return STATE_ERROR upon error in suricatta.pstate.get(). This change also makes it unnecessary to return a success indicator boolean as first return value. Signed-off-by: Christian Storm --- doc/source/suricatta.rst | 4 ++-- examples/suricatta/swupdate_suricatta.lua | 3 +-- suricatta/server_lua.c | 13 +++---------- suricatta/suricatta.lua | 3 +-- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/doc/source/suricatta.rst b/doc/source/suricatta.rst index 01102c3f..9782e591 100644 --- a/doc/source/suricatta.rst +++ b/doc/source/suricatta.rst @@ -397,8 +397,8 @@ defaulting to ``ustate``. In addition, it captures the ``update_state_t`` enum v The function ``suricatta.pstate.save(state)`` requires one of ``suricatta.pstate``'s "enum" values as parameter and returns ``true``, or, in case of error, ``nil``. -The function ``suricatta.pstate.get()`` returns ``true``, or, in case of error, ``nil``, -plus one of ``suricatta.pstate``'s "enum" values in the former case. +The function ``suricatta.pstate.get()`` returns one of ``suricatta.pstate``'s +"enum" values or, in case of error, ``STATE_ERROR``. `suricatta.server` diff --git a/examples/suricatta/swupdate_suricatta.lua b/examples/suricatta/swupdate_suricatta.lua index 3f01b0ce..dffc2909 100644 --- a/examples/suricatta/swupdate_suricatta.lua +++ b/examples/suricatta/swupdate_suricatta.lua @@ -171,8 +171,7 @@ gs = { function has_pending_action(action_id) action_id = action_id gs.polldelay.current = gs.polldelay.default - local _, pstate = suricatta.pstate.get() - if pstate == suricatta.pstate.INSTALLED then + if suricatta.pstate.get() == suricatta.pstate.INSTALLED then suricatta.notify.warn("An installed update is pending testing, not querying server.") return action_id, suricatta.status.NO_UPDATE_AVAILABLE end diff --git a/suricatta/server_lua.c b/suricatta/server_lua.c index 37e4950b..14167fe6 100644 --- a/suricatta/server_lua.c +++ b/suricatta/server_lua.c @@ -1458,20 +1458,13 @@ static int lua_bootloader_env_apply(lua_State *L) /** * @brief Get update state from persistent storage (bootloader). * - * @return [Lua] True, or, in case of error, nil. - * [Lua] One of pstate's enum values. + * @return [Lua] One of pstate's enum values. */ static int lua_pstate_get(lua_State *L) { update_state_t state = get_state(); - if (is_valid_state(state)) { - lua_pushboolean(L, true); - lua_pushinteger(L, (int)state); - } else { - lua_pushnil(L); - lua_pushnil(L); - } - return 2; + lua_pushinteger(L, is_valid_state(state) ? (int)state : STATE_ERROR); + return 1; } diff --git a/suricatta/suricatta.lua b/suricatta/suricatta.lua index c61d483f..9dc1bcfe 100644 --- a/suricatta/suricatta.lua +++ b/suricatta/suricatta.lua @@ -130,8 +130,7 @@ suricatta.pstate = { --- Get the current stored persistent state. -- ---- @return boolean # Whether operation was successful or not ---- @return suricatta.pstate # Persistent state ID number +--- @return number # Persistent state ID number, suricatta.pstate.ERROR if unsuccessful suricatta.pstate.get = function() end --- Save persistent state information.