From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=haytok.jp Received: from outbound.ci.icloud.com (ci-2001b-snip6-8.eps.apple.com [IPv6:2a01:b747:3005:205::15]) by passt.top (Postfix) with ESMTPS id 0AD285A0269 for ; Wed, 25 Nov 2026 14:38:16 +0100 (CET) Received: from outbound.ci.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-central-1k-60-percent-3 (Postfix) with ESMTPS id 67C5E18000D8; Wed, 25 Nov 2026 13:38:13 +0000 (UTC) X-ICL-RepId: 01a212ed-a2cf-786f-8de8-c7488a07e74a Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=haytok.jp; s=sig1; t=1795613894; x=1827149894; bh=xBES9yu6rDPFVRNkcMAykN8POtV5SS/463DIPnGmWBo=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=Vx2cC8sG28xg/x0Bu39BUokoZps03l6qaB6PHCWoFwR96oBzRg6SPWibN2/UvWB+pN8ITijIiHpl+NipbdryU1MglSXPgxeYVTZASJDxZaA2vqO9D1cUOvYyBvxgEtQB5rujjqTxUjj6uH2vS9n1u79BxMMClb1wNwjmY0Ylp43HdQgoq56m84BOP23zo2GiMpdh5AoOauxQz2Ro2dQ3HM7aVITcBarxtTgKDtzn/SY0ZbXyeWf0BvFRnU5ltcrfyXu7k3VEhCHZvMWIN9X6eHj3AIfdswO0V/ZmPQCmIxvXg7FdHvDX1TKd5I/3lKoKPHy08Tqwx1G1BwkT5KWzvw== mail-alias-created-date: 1766251435121 Received: from localhost.localdomain (unknown [17.57.156.36]) by p00-icloudmta-asmtp-us-central-1k-60-percent-3 (Postfix) with ESMTPSA id E5A501801305; Wed, 25 Nov 2026 13:38:11 +0000 (UTC) From: Hayato Kiwata To: passt-dev@passt.top Subject: [PATCH] pesto: Drop exit_status, use status to select the exit code Date: Wed, 25 Nov 2026 22:38:07 +0900 Message-ID: <20261125133807.26349-1-dev@haytok.jp> X-Mailer: git-send-email 2.50.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTI1MDA1NCBTYWx0ZWRfX0Ds+9vmwaOlu Vh6wuqdY1jnqUvgoLYTzo3zmn267jdGjfUk45ACaRaYjcwCL4Fj/HNcNnkovXGRFp0Lf9Mc/jpO m0+gsLWP80bW+dP+gihcPRdtC40oTJn41Xtur9rN4tNb9GjMXT4AKNuBlrbUbCssZXweFlmCCLc IgSOkJCebWHkf21f1g69f/70Erm/vU+iGhoAp40cY6LOBcpuegsaFek8bmnCilg3BxUUBXZ4uEi 3qzR9CjDdWRKxcCLvfg99gZ2U2PUbx6H8ohBlS4Nc1jTi5Zxl2pCbXlnLg9Bvb8uaB82FO5Pokt tMfsVmJR7O2u+dLxt9hy/lKIUfiQPSplc6YI4VshP0j6Otsz3l3HNrBkmR2rfs= X-Proofpoint-GUID: FybSHWVH9Eiqq53p75O4nTXMR-6ctcOV X-Proofpoint-ORIG-GUID: FybSHWVH9Eiqq53p75O4nTXMR-6ctcOV X-Proofpoint-Spam-Info: AW1haW4tMjYxMTI1MDA1NCBTYWx0ZWRfX8FRiBnP2j6V0 GrbiPwXKPM1L2AzWDdhGRxcKPNgCb6YKHZMZjpkU3Z6ONPIikcyRKyRYc5W1Fe6Y7/mq5ovnllB RDQZ38p86sXKBko/il2KuEVJNemJMCM= X-Authority-Info-Out: v=2.4 cv=XrZvqlF9 c=1 sm=1 tr=0 ts=6b06e4c5 cx=c_apl:c_pps:t_out a=2G65uMN5HjSv0sBfM2Yj2w==:117 a=2G65uMN5HjSv0sBfM2Yj2w==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Lz8lNifEoAKVmCoaIBl5:22 a=RFeMYaZ6Aqw0RB263Fta:22 a=pNgXkJcRAAAA:8 a=20KFwNOVAAAA:8 a=tlhMxo6ANt-nJvSF4Y8A:9 a=tKe0A8swS_RTMQ4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JsTAe W7sTvelscG1Us070VadB8Lz+tRxSvzoFkIi+YthExv1ChprytYredbqoVJ6flexdK5aWM/ ESkGIVVEeAyzkkV8LnpjIG370ZoohobH75WFTgfWyXgNP8lgTpBsPzuHqfdiAp97ILbLoS OMNXS0YDtUSI90AZbLggndQVuuDUtbNyqKX8F7rZRMESCgzRdoeuSwJA== X-MailFrom: dev@haytok.jp X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation Message-ID-Hash: GJPAPXJK5HF4PVEK7TF2EGRPJMRXIOMV X-Message-ID-Hash: GJPAPXJK5HF4PVEK7TF2EGRPJMRXIOMV X-Mailman-Approved-At: Wed, 25 Nov 2026 15:20:56 +0100 CC: Hayato Kiwata , Stefano Brivio X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Commit 885c39e8b999 ("conf, pesto: Notify client of the result of rule updates") added an exit_status variable to exit with a non-zero status if the server reports a failure. However, the status read from the server already tells us whether the update failed. Drop exit_status, broaden the scope of status, and select the exit code from it when we call exit(). Initialize status to PESTO_STATUS_OK, since it is not read from the server when pesto only shows the current rules or the server uses a protocol version older than 3. Link: https://archives.passt.top/passt-dev/20261120235844.75da1afa@elisabeth/ Suggested-by: Stefano Brivio Signed-off-by: Hayato Kiwata --- pesto.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pesto.c b/pesto.c index 03edc29..fe5a536 100644 --- a/pesto.c +++ b/pesto.c @@ -318,7 +318,7 @@ int main(int argc, char **argv) struct sockaddr_un a = { AF_UNIX, "" }; struct configuration conf = { 0 }; bool update = false, show = false; - int exit_status = EXIT_SUCCESS; + uint8_t status = PESTO_STATUS_OK; struct pesto_hello hello; struct sock_fprog prog; int optname, ret, s; @@ -515,8 +515,6 @@ int main(int argc, char **argv) send_conf(s, &conf); if (s_version >= PESTO_VERSION_STATUS) { - uint8_t status; - if (read_u8(s, &status) < 0) die_perror("Couldn't read configuration status"); @@ -524,16 +522,13 @@ int main(int argc, char **argv) case PESTO_STATUS_OK: break; case PESTO_STATUS_ROLLBACK: - exit_status = EXIT_FAILURE; warn("Failed to apply new rules, old rules restored"); break; case PESTO_STATUS_FAILED: - exit_status = EXIT_FAILURE; warn( "Failed to apply new rules, couldn't restore old ones"); break; default: - exit_status = EXIT_FAILURE; warn("Unknown configuration status %"PRIu8, status); } } @@ -542,5 +537,5 @@ noupdate: if (shutdown(s, SHUT_RDWR) < 0 || close(s) < 0) die_perror("Error shutting down control socket"); - exit(exit_status); + exit(status == PESTO_STATUS_OK ? EXIT_SUCCESS : EXIT_FAILURE); } -- 2.50.1 (Apple Git-155)