From patchwork Fri Nov 19 09:03:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1557000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=IrmdCM0P; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::637; helo=mail-pl1-x637.google.com; envelope-from=swupdate+bncbcwivbv7sugrbbwr3wgamgqea4dfhoy@googlegroups.com; receiver=) Received: from mail-pl1-x637.google.com (mail-pl1-x637.google.com [IPv6:2607:f8b0:4864:20::637]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwW1n0sX0z9sRN for ; Fri, 19 Nov 2021 20:04:11 +1100 (AEDT) Received: by mail-pl1-x637.google.com with SMTP id a4-20020a170902ecc400b00142562309c7sf4255788plh.6 for ; Fri, 19 Nov 2021 01:04:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637312647; cv=pass; d=google.com; s=arc-20160816; b=duND5H+dbdzMrb8z2wVbVCCHHK6D75mTbR/Ba6bgu9hNz4Vt9gftwkc0AYFHlw/Qyp hXqvmh6zqn0Ak5HZMiNkLSsXRyaaM7cN/aHx2rPTKTLoUmai1jKVqwqFQxnvAElcrwnz Vuy2jGJc9Is6hUmIJrxJIq2dmQ2SuOpfBUTKVv0eZNMpZa6uPSEMyKUJ0vOTrA319g9v 3Ej1S6TGROQVggZIc5McgMfLlhrrIbLYXZxi7HFGSWzWAVVx4Ey9nibtta5B9aMTMil9 SR1BsX1eA1UDaeXLbMgoD5AFM801lDS8owF7t/cAlinbXKjMciQ4U7DQ65mNs0j0DoXN ukFg== 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:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=aOTOM+2kcZNvTvTU+F2fDB2vb0ppBGmv7iJGHdVP+cU=; b=nJceHBbDVFRYs+oM/9b0/XLIrFs3Pyv405zPSzoFA7rtTQLrHAipRlqMwT+tnxn5Df jdPv5428fooXluDLjAd6S5hYwXc4ZauyIUJbLw8Nz+7m7ufFkQjjLgMkfPzhx1bXFbFz 78aVnBH+P6dQh13svKSQ8ixiuhXcM0eSzbnvD/rY0fozRM3OdgrDVLMpdireHkixyU2d ttE/aaruHqt0I8+SUEfYgaSYoOrGgJvmc7I+g4PQeEMWupq6XRbUHKFixsKBGPMWm/S7 ompRjU4f1EVDzvVhmUw4xjGSUA+OMmRIo5UX4lNSOMdnjgwqX3vN8ENsTXbP+ARijUv2 3OCQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=aOTOM+2kcZNvTvTU+F2fDB2vb0ppBGmv7iJGHdVP+cU=; b=IrmdCM0PU31j6P42nktGCBDqpou2Fqr6Ju02coK13meSnlL4ad8E8qzpVpM29jNryH /aRVg/S5SxUkX/jP9+9eba4V//si1ghKDnsyqzb4IENEo4wFV3YPDO27ncLJUPo6AukE RFERN3IPglB5J36JI/kScwDSMk173rhyUw/M7E32bezLhI6+WadHHqf8UXwLYzg0NjBV u0nJ7EoJI8ZDP/3+1iBYI/ZIxleG4+VfiKtbNTSOlYjpHea27/5qeqKCehfrY+mvEuAt AAetEFXUSBxh5spyrMAVGRp/seGVehiSwNnI//5ENkgT7UY8b1aVBmyjS1txpFzWdxi2 iBAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=aOTOM+2kcZNvTvTU+F2fDB2vb0ppBGmv7iJGHdVP+cU=; b=2RNLRqSVSW8skm9BPDOm7Yt49wv60d7PVrU1q1Sg5SoN+ZbxE2i5iFxf3MASEnXWSe OP9cA377YUymimqIRsEcNGZHyO8Ku4Y66+3Qg32uOTNpPMYH3P+r3GTPmINAb5v9nAbf sltfgavuVFnLAz8TkDE8KRae/OEBplTfPE+u/se6tznZaIHABqYBg3WjHhPCahyjBrds XMZqa0m2GHB/ahWGF/N+tpobtkcalFoc4N68g+4xBtI4cwMKlChkBkOY4yaJffKum902 GR5hEoV4hTsshi9ogXd54ylgw6D4EQaCB8/yvNkasSSw2EgcfCYBQcdBSlPbLkB+7B3P 09lQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM530QDCrYLIQRxadkq5a+tFPXMcfgPvtEQ8zFBa4mubA8qiWNWWHO Roqh1w2EhORqvC6bb3UaSpE= X-Google-Smtp-Source: ABdhPJxN17EKIyQaJGWLDNJB0qEybGxJlXQqMQmf6CZMtPGXVInmcBeYOeBbQnCbs9qaJoiMnNx/iA== X-Received: by 2002:a63:42:: with SMTP id 63mr16038468pga.127.1637312647335; Fri, 19 Nov 2021 01:04:07 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a62:8cc2:: with SMTP id m185ls945595pfd.6.gmail; Fri, 19 Nov 2021 01:04:06 -0800 (PST) X-Received: by 2002:a63:a50a:: with SMTP id n10mr8515523pgf.310.1637312646494; Fri, 19 Nov 2021 01:04:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637312646; cv=none; d=google.com; s=arc-20160816; b=CZW6RKtFtAysDs0sCLxtc04Yy5oztqnQUTRHeIVS0Y4ERJ0Dl/n38e7uz/6vj2yk6r 6cRQ1QJ4LFL66oP6bCJGm3wz3UigJBWdT84ZeEWLraRUtGzTf7HBnk8JC/xqDDU8UHyz UjqZ3razbwnJu165+f5V3Gwa+PLs/vcPI1XGKYUeY6XThf6fCARpiv5+MZv1SeIrnlCE 6twbfnYW2dNPWMY0ukXDPU8QHXXOlVC7foPVEyvn+NW2P7/aY4+1Y20NoUFjkoS9u3zP 7zFAUU51riKO4+U8CxwbEBVJzOauL06ZFXj6GpgnRsl7+xFqfU9Bh4H1nTImyAHbUut8 4Diw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=ABD2CaK5LyTKnJZDrna7sJQuGIlpa7PJypYbjTrx228=; b=kBU/8Q78LRhwGnjvgMyJNTBYA1xv7LOrxIb1JXX725FXXJz5v/qIkGKz9oSofFMYpB TY6u1umqqFF/wB3SuqIK8SecwdpK+LS+UGesyGnqns142tfa+f/UfzwnCP5mlOGLcdcO TRSh099YeAbxOMhxa5K7N/nQTuKMxaIIvCa8eY43pUIoijcLN2As0pkzP5Fpu0roAydc M9yaAWFHscbwH4Lfl+kx7UkeodB8Ed7E3bjtfIKm8B0yaajNLKLq88FRM3z8PltSYNoN vzerU9DaI2JtH4HAEBmpd0xKMHGBxT9Fu+kXnvNIWhguRURYLt+Qn3snf5KlRAXeuoJo p1Ow== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Received: from gw2.atmark-techno.com (gw2.atmark-techno.com. [35.74.137.57]) by gmr-mx.google.com with ESMTP id 64si650524pjo.2.2021.11.19.01.04.06 for ; Fri, 19 Nov 2021 01:04:06 -0800 (PST) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) client-ip=35.74.137.57; Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id 47AF520D46 for ; Fri, 19 Nov 2021 18:04:05 +0900 (JST) Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 2796820D46 for ; Fri, 19 Nov 2021 18:04:05 +0900 (JST) Received: by mail-pg1-f197.google.com with SMTP id p27-20020a637f5b000000b0030c116f1a68so2304666pgn.4 for ; Fri, 19 Nov 2021 01:04:05 -0800 (PST) X-Received: by 2002:a17:902:e8d7:b0:143:a088:7937 with SMTP id v23-20020a170902e8d700b00143a0887937mr74265464plg.63.1637312644239; Fri, 19 Nov 2021 01:04:04 -0800 (PST) X-Received: by 2002:a17:902:e8d7:b0:143:a088:7937 with SMTP id v23-20020a170902e8d700b00143a0887937mr74265444plg.63.1637312644029; Fri, 19 Nov 2021 01:04:04 -0800 (PST) Received: from pc-0115 (117.209.187.35.bc.googleusercontent.com. [35.187.209.117]) by smtp.gmail.com with ESMTPSA id x33sm2116708pfh.133.2021.11.19.01.04.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Nov 2021 01:04:03 -0800 (PST) Received: from martinet by pc-0115 with local (Exim 4.94.2) (envelope-from ) id 1mnzoQ-002n0i-Ju; Fri, 19 Nov 2021 18:04:02 +0900 From: Dominique Martinet To: swupdate@googlegroups.com Cc: Dominique Martinet Subject: [swupdate] [PATCH 1/3] fix missing field initializer warnings Date: Fri, 19 Nov 2021 18:03:59 +0900 Message-Id: <20211119090401.664993-1-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com 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: , fixes warnings with -Wmissing-field-initializers: - hnd_priv missing partlists init, could also have added a final LIST_HEAD_INITIALIZER() but it's easier to maintain by naming the only field that's actually set - commands was missing usage callback With this one can compile with -Wall -Wextra -Wno-sign-compare (there are too many sign-compare warnings for me to fix right now, but a quick glance saw nothing too horrible) Signed-off-by: Dominique Martinet Acked-by: Stefano Babic --- handlers/diskpart_handler.c | 4 +++- tools/swupdate-ipc.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index aeae1ad5f423..268ae6f54ee4 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -760,7 +760,9 @@ static int diskpart(struct img_type *img, int ret = 0; unsigned long i; unsigned long hybrid = 0; - struct hnd_priv priv = {FDISK_DISKLABEL_DOS, false, false}; + struct hnd_priv priv = { + .labeltype = FDISK_DISKLABEL_DOS, + }; struct create_table *createtable = NULL; if (!lbtype || (strcmp(lbtype, "gpt") && strcmp(lbtype, "dos"))) { diff --git a/tools/swupdate-ipc.c b/tools/swupdate-ipc.c index de1e1e111bf1..b70d78fa7df3 100644 --- a/tools/swupdate-ipc.c +++ b/tools/swupdate-ipc.c @@ -596,7 +596,7 @@ cmd_t commands[] = { {"hawkbitcfg", hawkbitcfg, usage_hawkbitcfg}, {"gethawkbit", gethawkbitstatus, usage_gethawkbitstatus}, {"sysrestart", sysrestart, usage_sysrestart}, - {NULL, NULL} + {NULL, NULL, NULL} }; /* From patchwork Fri Nov 19 09:04:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1556999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=FUPc1x3+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::43e; helo=mail-pf1-x43e.google.com; envelope-from=swupdate+bncbcwivbv7sugrbb6r3wgamgqexxrdewq@googlegroups.com; receiver=) Received: from mail-pf1-x43e.google.com (mail-pf1-x43e.google.com [IPv6:2607:f8b0:4864:20::43e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwW1n0vdGz9sRR for ; Fri, 19 Nov 2021 20:04:11 +1100 (AEDT) Received: by mail-pf1-x43e.google.com with SMTP id e7-20020aa798c7000000b004a254db7946sf5284211pfm.17 for ; Fri, 19 Nov 2021 01:04:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637312648; cv=pass; d=google.com; s=arc-20160816; b=nEDxGDLQY43RXq89Vxe4sGpbZecc7iTVJ3De+hlNO0fnQ6EAEoxBVJa3GmfI9sdhPV y6aiHar+VOBHzka0PSIMF/0k/9SctFQ+t+pQpauFmWol2j5RQ41B+2vQOgsT3LkYqGbk f4FzlZrDPT1SlHMhpDXolYpCSVgs8ZpM91qyhG8cAxOnlaIf5SD8UgFtXsyW8m0youQt Q3w338btGeRkekQ8ZJ7O3TVaioOnoaYVlapkM2HJPd2CuaJGU3zjB5c8TUS5Vq3weChP 28kEay/bIxigmM11GRGDcZ25+EVNg3VN9tpU8QPWgwtWaILPFsajfPII2T76XejcYNq3 fhmA== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=Hzs+gxJivHaxL1IFINcr2I7i87CtHaLISwOgX65AJBc=; b=heR3TghrWPC/ivBZ3QvPREQIB5KpsGX+rpreLFNjeC98kCKEnzFbRvH30oKLQsbxiw gFI0EdjMpfshmB+KIEDksjyEfaP2yekPk9d31hPx9fvuTDedW0xm0GexjegAtlI5zCBt NqnlyrE6PZaOeyWZaot66ubZk6PF7QjT+OANRoCYmKKGCpWiq5ECq/pxXSTZnFyiVut+ 6FaXum8/ChS0L92xeF2SQePfvplJZKSgzUD7pyI2vzRJ+dfkKbSEjtWZ7gZqEKOHIkQY R8/RnAZL/g/ayvWXTUgs2NOChy20Dx5vCoRgnGR/mtJSt1MYVp7DP+sik+SigcoGO5g0 vJzg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Hzs+gxJivHaxL1IFINcr2I7i87CtHaLISwOgX65AJBc=; b=FUPc1x3+MWZzF2QcPnFRMXgoJx6PG49OyAipn9vaL5+ckn1tzV0ouFhY8UHpM0VZXR v1WV2o5AbpyDwxcUYQyQqoiwbaoy0mUzvrFxtf0r+VYY75h1UDHHQ4gnDfPtt+n79lHX pfVY0UGSlakpGBw5flkL5NVk5xI/Mf/UHPD0L4pVQtgVrXupvIBPAzZrfT3vWR0mev7G HsU049mf8aBYuCUYiO0s1E2xgb1T82/4+kpYrUM4RqBo0lkYtBBwCg9aPsaY0Z3GAMc/ uOX6GRaPZoJhDU14GWbltUDSJsybza357g6czhKguL157XcKXA23dale15Al1UHIZOYh SMWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Hzs+gxJivHaxL1IFINcr2I7i87CtHaLISwOgX65AJBc=; b=nJufxLR9rXyJrBQ1w/PxqPxEPO/AQ+2zXKJTb+ek2XcQs5WObXjuUXRQXJZo7fhmIQ sQffB/zEV9NYmLBfipmalzS7EVgRQKCXaWGWfQC0Qa69fQnIdyh0lcErDE28/yqu7Ly/ 4sj7VEN8CWIbKBLiOiqvN366Sf1ihOk7fLMHbbmw49CM0DwA5rvW6GP0ZKMoA2rEfg8x JCmM9ySARQhwAtcy/2pboFlVtIDSrYCOLy0VnXvDVeQUTgwaIEgqmbzavp4s9AHQGzaR ciYT1aURTLQgwXC/a4PezdIkEO1l6s9bD8KnW0AII9XUhILaX3nidCc21Dqcc3czQnr4 +Y+w== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM530/lSmUdHvKIvq6ZEXMPpA964CU2a7ViibVS8NQFqffk2iFwJ9h XYg8IMVZSw0KdrU3O+5tquE= X-Google-Smtp-Source: ABdhPJx9fGlW3/7RPOn+2cPnE4sxJgl/NrcYuAz9A/4jMJq7ss3u/ETJxRXG58gcNNyCnv9uSf6bcw== X-Received: by 2002:a17:902:6905:b0:142:9e19:702e with SMTP id j5-20020a170902690500b001429e19702emr76150538plk.34.1637312648188; Fri, 19 Nov 2021 01:04:08 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a63:194d:: with SMTP id 13ls622653pgz.5.gmail; Fri, 19 Nov 2021 01:04:07 -0800 (PST) X-Received: by 2002:a62:9215:0:b0:49f:e38b:d043 with SMTP id o21-20020a629215000000b0049fe38bd043mr21424276pfd.86.1637312647253; Fri, 19 Nov 2021 01:04:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637312647; cv=none; d=google.com; s=arc-20160816; b=qNvBL04xMdD3pJb6fbag8yu4zlE1HIhRFQEuA8XEWGOkJZT5p9LMevXeq4xbs3+xJt njYruPJSc45ezrJ9rrLQl6BQeB6Y97Puz0QWk8npCIWrDljJq3EcAVGdZI/jCo8ZEbMX RpGUxnApAiLpwquU+8Q3Rt0Nc1FV+9tesdVgNAgPbprtMCi84BP9cZS7vp35SXHqDonI YFpj0+lClmQSxo+Ua2pHNikE+xsl5G35FM1m0FVgLTyt/oZJDlImCbBzZvHwVYSB5F5B OwRGBJJGHlqLg6egYQyb/mSO+wJAsNkr6dpRptRd2m3J7uF45sgU6bdw2MQhtvkxjRc0 gQwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=KZNcX2S8I1cFlIQjgoH4Bhp8ZK7tRlHF0M/2BEfWwXM=; b=hY2/+qjv+oLHLFom9UxfiyUVudvrthxVN1bKNISkBm5DYEfu9PuMK9MGxOXwLaohvP 7ASeJf60CcUs8mVimh+C4rB4lmVJ0N2o3QnWR5D4BgdCVhZrn8Vdlg6T+128NDVwLs7e VO83lz0or0+8KI+oRbfY4kIod9rLgdlONhD1LjVzhsGW/HIL5zKPAFl73CISBI6ZNXAZ IArbhqMlAo+Y8o7AEEz66dY8Ubot2xiflTDpRL8Kl/LOjIm9urS1PCKBk7BH+X8rynek XWUUjv6n0h64Ik9NjNLKoUy6cEAD0yWnOU/NHrTXSB+QySuh+X7hGliloAY7xiOF4wzn 9HRg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Received: from gw2.atmark-techno.com (gw2.atmark-techno.com. [35.74.137.57]) by gmr-mx.google.com with ESMTP id s24si85856pjp.0.2021.11.19.01.04.07 for ; Fri, 19 Nov 2021 01:04:07 -0800 (PST) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) client-ip=35.74.137.57; Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id 279ED20D5D for ; Fri, 19 Nov 2021 18:04:06 +0900 (JST) Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 0837020D5D for ; Fri, 19 Nov 2021 18:04:06 +0900 (JST) Received: by mail-pg1-f199.google.com with SMTP id r15-20020a63ec4f000000b002e582189837so3924349pgj.20 for ; Fri, 19 Nov 2021 01:04:05 -0800 (PST) X-Received: by 2002:a17:903:41c1:b0:141:f28f:729e with SMTP id u1-20020a17090341c100b00141f28f729emr73929746ple.34.1637312645144; Fri, 19 Nov 2021 01:04:05 -0800 (PST) X-Received: by 2002:a17:903:41c1:b0:141:f28f:729e with SMTP id u1-20020a17090341c100b00141f28f729emr73929718ple.34.1637312644920; Fri, 19 Nov 2021 01:04:04 -0800 (PST) Received: from pc-0115 (178.101.200.35.bc.googleusercontent.com. [35.200.101.178]) by smtp.gmail.com with ESMTPSA id l11sm2066278pfu.129.2021.11.19.01.04.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Nov 2021 01:04:04 -0800 (PST) Received: from martinet by pc-0115 with local (Exim 4.94.2) (envelope-from ) id 1mnzoR-002n0s-FI; Fri, 19 Nov 2021 18:04:03 +0900 From: Dominique Martinet To: swupdate@googlegroups.com Cc: Dominique Martinet Subject: [swupdate] [PATCH 2/3] run_system_cmd: do not consider command over if child stopped Date: Fri, 19 Nov 2021 18:04:00 +0900 Message-Id: <20211119090401.664993-2-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211119090401.664993-1-dominique.martinet@atmark-techno.com> References: <20211119090401.664993-1-dominique.martinet@atmark-techno.com> MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com 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: , waitpid() with WUNTRACED or WCONTINUED will return the pid if process has been stopped or ptraced, which can lead to swupdate considering the command being run before it actually is if something interacts with it. We don't actually check WIFSTOPPED/WIFCONTINUED below and don't really care about this state: just remove the flags to waitpid() While we are here, only check WTERMSIG() if WIFSIGNALED is true, and add a final neither-stopped-nor-killed state which probably should not see much use Signed-off-by: Dominique Martinet Acked-by: Stefano Babic --- Note: sigchld_handler does check WIFSTOPPED/WIFCONTINUED without setting WUNTRACED/WCONTINUED flags to waitpid, so these should never match in theory and could be removed core/pctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/pctl.c b/core/pctl.c index c31575aa309b..2a09d9807e3a 100644 --- a/core/pctl.c +++ b/core/pctl.c @@ -328,7 +328,7 @@ int run_system_cmd(const char *cmd) fd_set readfds; int n, i; - w = waitpid(process_id, &wstatus, WNOHANG | WUNTRACED | WCONTINUED); + w = waitpid(process_id, &wstatus, WNOHANG); if (w == -1) { ERROR("Error from waitpid() !!"); close(stdoutpipe[PIPE_READ]); @@ -386,9 +386,12 @@ int run_system_cmd(const char *cmd) if (WIFEXITED(wstatus)) { ret = WEXITSTATUS(wstatus); TRACE("%s command returned %d", cmd, ret); - } else { + } else if (WIFSIGNALED(wstatus)) { TRACE("(%s) killed by signal %d\n", cmd, WTERMSIG(wstatus)); ret = -1; + } else { + TRACE("(%s) not exited nor killed!\n", cmd); + ret = -1; } } From patchwork Fri Nov 19 09:04:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1556998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=eBgfB/ZE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::103d; helo=mail-pj1-x103d.google.com; envelope-from=swupdate+bncbcwivbv7sugrbcgr3wgamgqegi4iajy@googlegroups.com; receiver=) Received: from mail-pj1-x103d.google.com (mail-pj1-x103d.google.com [IPv6:2607:f8b0:4864:20::103d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwW1n086Pz9sPf for ; Fri, 19 Nov 2021 20:04:11 +1100 (AEDT) Received: by mail-pj1-x103d.google.com with SMTP id p8-20020a17090a748800b001a6cceee8afsf3118530pjk.4 for ; Fri, 19 Nov 2021 01:04:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637312648; cv=pass; d=google.com; s=arc-20160816; b=VQRi9aS5znvjG3O7UFXQcoHILUo3wi9M+JWM6+IR08ow4KD/19HXrLD0+UzrAMPjIB rKFYnEbdhXnDjDXu9uHiEWSrIny5qPIzOLa2RTe6RBboSi52uGv79gl8mRjF2QS5Dbs0 zyLNYssHBhRLlWBJ03HwM2AypBbujwbMeuzGewDZKQ28YoftPkcX4xAiNNBQACYlSYSx lR1qXG1+m9pOktzLOl9goMi/dWJTL1C30oyqytsiDlcAY6KBQg6f1QQq7w6CzHZ+NFCy FnuzmqyTQW5ua6AuFU8ymtTlL5tzdcnggvO8kZjrSYia9zV+/0tMZmvKTZfxxxDpTdk5 RgbA== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=kSQNO5xlieLLJ5gsUBCVqRfu5h5V8q0hu4ABjpIUYM0=; b=cKVSuEAmTrn+Yedvo1cRFibiPA2AGBTJWhrpouxb3jjnhp6DqNYYLIIHGE/GxLkTZw bxIR7xAVSaAIl5ULgjvEKystOoxdkFEwEV+EWNdVy/JoLjO+cO4HY8TVUSBypw4JFf8O QN1OmrfXcDBjgL7yuJ9B5U8v2dOLVHhI1cOe3bqUEsdcCCHcXa2996/VnCn58HqXDCNa 7UlSmUNGlGB7xdNgM9IcQ49XbmmQgT3ia12fPD68QgFX7yyT/RSP6zgbVb+g9r4WByJJ Ub8LmLKxMDrMwzy+fKUI2ThcdFMHbMcp+yRqDhQrnrik//eWvuFDStd9ydk5v9t+agvD U15Q== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=kSQNO5xlieLLJ5gsUBCVqRfu5h5V8q0hu4ABjpIUYM0=; b=eBgfB/ZER9FzW9+3l41XNtVXwxI6k0s/N+CgaJqG0bhEq3vY1TURcsJH4ijIJxKeH/ FjexWSApqEspZKCQ/vTw/qHG93wJLMVwLFB3oXUpOuVwMFNwv5CPV8QhRiLCCFOtUMpZ Xj/JKwSTmTrnRMfplo6TdiTTlk/xu6UgJhRQsusoAParbM9xjF6nOZgorCS6ccBCdnpZ Dy1kIzLZNsihd0ZiRjWa2UMK/0TdL3JigviRIxCkV/d80jolJQ3yGvzc635quwtjlq2n FI0srvr1U2bIomrumIt2x7UOiEmd36wzo3wJ7Lt7tsptoG+hIvIq0EX1hH/R0aHC6oEZ fI8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=kSQNO5xlieLLJ5gsUBCVqRfu5h5V8q0hu4ABjpIUYM0=; b=QJ5piqY5efrahgQAyHraDeGKQwpzzitTBgYa+8YicOjyuInIjA9kE1NtjTAiRE0LNU SJS6RkOWcAhnLdu/FXWBfzCS/SRf9ITpyRwHrTuoiRl63AIi1yttpvmAgJMWK18HiMa/ I2c76xILpBrbGAZNdwGHhkUWiASzxrxo14JMZNMsZ8wj2WEffDOOJ0x1Kal5cjHcf97I k9JpAPF3a37HcA3bDxW85kYswuveFQFsMWx1cD8IAVB8/f2/n5w21861fgUoruBccWuI lHBA1rLjpNZvjcGS6a/iIUpxR1vryR0zW1eho4r4tRk2ommMmJDi8c3LSadIBdZitNEO N4yA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM53312yA4QjZp9OVWgU5j6RzqRFSFQB2xlgg5DTnvWCGrp6TG0zHQ E8rA/pDWr89uoS7yPJAeqVw= X-Google-Smtp-Source: ABdhPJxQ3HvQBh1/eBXM2m+Z5UtTSQHTvuhcKXqe1IX4PZR2jCDBtOf8aecLkB4/O69HBmpiLkwchg== X-Received: by 2002:a05:6a00:1ac9:b0:49f:b38d:fe7 with SMTP id f9-20020a056a001ac900b0049fb38d0fe7mr63111568pfv.63.1637312648425; Fri, 19 Nov 2021 01:04:08 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:902:d50e:: with SMTP id b14ls1580312plg.7.gmail; Fri, 19 Nov 2021 01:04:07 -0800 (PST) X-Received: by 2002:a17:903:245:b0:143:c5ba:8bd8 with SMTP id j5-20020a170903024500b00143c5ba8bd8mr50523022plh.64.1637312647719; Fri, 19 Nov 2021 01:04:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637312647; cv=none; d=google.com; s=arc-20160816; b=Ywq//NQzQuavUvH2aDaU1D+aZfspEirrSdNaMJJkeumkFpC7f5F6rnJRzVeggjNNqt P7P1q5q50gi95vH/4iY6GEi3ySUdayebXu30flbEQt5rEqpgSSCcka2ymmbIQ3zPvVWX nDXS3NfgQTYgkGM3leu0hHyzLXS0LuL4ulfe0hzJ7aaolnSFoh+E0o11oyNIhPr2lDT/ KC8e+YwinC/cJ8mwRI+uLrMyzSeMaoKs6Za5PEHWK/uF+r+Lodj3oNVwzSsAdYXBilLO MJ5uNtpvS6e9tNBuJCj1We+vP8EzU9TCMzJQVATMb2qfidw/LIxbk8tW0JwgWZjHs076 LEEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=MGaGbonWavRMdoDLOx7+jUW7/Onytrkrc4nj19BPNOM=; b=NSnJTzZtxrlPx3aijfz/KubwyJYj4tapBu4eZlMbo708m3P2hvYrNTa3BGH7JK4x1f LhbU9bF/1hOmKv4bTUKShhaAbHDRJI/g77MFAVWCQfhCLt2Rf5nh4QPxEcGYEpCLUkpz 22YRDxu6bWHupWFLIQsKdXxHoWYy7voHvCjO3cffUq6OUMF3lZT++dr/elKaFfp09Vm8 xpRdvk6Dn1p6FPIP6d32S0EaLBKGD0OYERHF+AOnN4iSLvvQJzWWx+vzUGEsOmKEWBnu CEdw7p36ZKLYzsgEBZYRHwwewLbeLWIJo+qRhXbPzW6LjoaN3SK4k1sWFUUrn7GR8ZVq 7rKw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Received: from gw2.atmark-techno.com (gw2.atmark-techno.com. [35.74.137.57]) by gmr-mx.google.com with ESMTP id pi11si160769pjb.2.2021.11.19.01.04.07 for ; Fri, 19 Nov 2021 01:04:07 -0800 (PST) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) client-ip=35.74.137.57; Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id 9924020D5C for ; Fri, 19 Nov 2021 18:04:06 +0900 (JST) Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 7E7DB20D5C for ; Fri, 19 Nov 2021 18:04:06 +0900 (JST) Received: by mail-pl1-f200.google.com with SMTP id p16-20020a170902e75000b0014271728fd6so4245584plf.18 for ; Fri, 19 Nov 2021 01:04:06 -0800 (PST) X-Received: by 2002:a17:902:c7d5:b0:143:72b7:2ca5 with SMTP id r21-20020a170902c7d500b0014372b72ca5mr74494774pla.20.1637312645489; Fri, 19 Nov 2021 01:04:05 -0800 (PST) X-Received: by 2002:a17:902:c7d5:b0:143:72b7:2ca5 with SMTP id r21-20020a170902c7d500b0014372b72ca5mr74494736pla.20.1637312645226; Fri, 19 Nov 2021 01:04:05 -0800 (PST) Received: from pc-0115 (103.131.189.35.bc.googleusercontent.com. [35.189.131.103]) by smtp.gmail.com with ESMTPSA id a12sm9975863pjq.16.2021.11.19.01.04.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Nov 2021 01:04:05 -0800 (PST) Received: from martinet by pc-0115 with local (Exim 4.94.2) (envelope-from ) id 1mnzoR-002n0v-T4; Fri, 19 Nov 2021 18:04:03 +0900 From: Dominique Martinet To: swupdate@googlegroups.com Cc: Dominique Martinet Subject: [swupdate] [PATCH 3/3] ipc_wait_for_complete: wait a bit if the first status we get was IDLE Date: Fri, 19 Nov 2021 18:04:01 +0900 Message-Id: <20211119090401.664993-3-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211119090401.664993-1-dominique.martinet@atmark-techno.com> References: <20211119090401.664993-1-dominique.martinet@atmark-techno.com> MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com 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: , It's possible swupdate_async_thread finishes writing the whole image and starts waiting for install to finish before the install actually started (especially if image is small and with -i) In this case, the initial get status call will return IDLE and be handled as if the update was already finished, and exit after 1s wait (because the initial status = IDLE == returned status, the loop also waits and swupdate exits for seemingly no reason 1s after the update started seemingly normally) Normally the notify() calls will build a backlog and we could assume that we will eventually get a non-IDLE state here, but if another process checks the ipc first it's possible all the notifications have been consumed and we cannot rely on that: only wait once, and unless something really bad happened hopefully after 1s the update will really have started... Signed-off-by: Dominique Martinet --- I'm happy to do something else here and only added this delay as a stopgap: if you have a better idea I'm all ears. In particular I've thought of extending the status with a loop iteration or something, and check before install and in wait that the loop iteration changed, but even that might not be robust if another process raced us (although that's quite unlikely in the swupdate -i case...), but changing the protocol is probably overkill. Slightly unrelated (it wouldn't help here), I've been annoyed by this loop polling every second, so having something like callbacks to reply to get status only when status changes would be something I'd like doing eventually Thanks! ipc/network_ipc.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c index 5ccc18b6c6d4..0fa585e69323 100644 --- a/ipc/network_ipc.c +++ b/ipc/network_ipc.c @@ -338,15 +338,28 @@ int ipc_wait_for_complete(getstatus callback) break; } - if (( (status != (RECOVERY_STATUS)message.data.status.current) || - strlen(message.data.status.desc))) { - if (callback) - callback(&message); - } else - sleep(1); + if (status == IDLE && message.data.status.current == IDLE) { + /* if we get idle state on first iteration (status == IDLE), + * then either the update hasn't started yet or is already + * finished and someone else already consumed all the + * notifications: wait 1s and retry just once in case + * it's the former. */ + sleep(1); + /* use some invalid state to not skip next callback... */ + status = -1; + continue; + } + + if (status != (RECOVERY_STATUS)message.data.status.current || + strlen(message.data.status.desc)) { + if (callback) + callback(&message); + } else { + sleep(1); + } status = (RECOVERY_STATUS)message.data.status.current; - } while(message.data.status.current != IDLE); + } while (message.data.status.current != IDLE); return message.data.status.last_result; }