Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3462936iog; Mon, 27 Jun 2022 17:05:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tjToyfz+YOnmY1hE+Y0GfY3mSe+XvlavYmVIkI1AKQmfzUNnEa9Fo+nnNxIm5XEZB2bZuR X-Received: by 2002:a50:fc90:0:b0:435:6b30:f1b0 with SMTP id f16-20020a50fc90000000b004356b30f1b0mr19895219edq.423.1656374756800; Mon, 27 Jun 2022 17:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656374756; cv=none; d=google.com; s=arc-20160816; b=SGmL3qP0DXeU4pDE/mC3WzeL2Im18e37EDfwU0ytk9n3Mk0AU/dJUV8bp1syk3V5my RXDXpTVEtowRmA1MC58Wgo+RnEG7LN559UoXeRgOwEkIVNaHydGzts8l4ZOKLBgEaJrS 6hdHa5Q3d0GCSlUCUW/gxOYovBeDmb5yrdAzDAUQa/xe/FisWat8MXyMefhdp1iCHHhJ s8thrWJYefYl/t9R1YZkU7+v9wPDmhu0xKMCF4R96g2RW7zJpXUzA0S2k9kH+LPTf/eV 542H8gonD8UOJc8CblakWzlyPAE7dukSeapAtfASk501jBD1d2KCsSp/MDJWy0UzyuF0 nQPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=okYGzS6nOTYlZZAMchTT9K3Y4SxXc87BdV2jtyMOSa8=; b=hzopZ72r8jPV1rQ+3I9vzWJ81Gk5SzBHMbRVESYFqcf5Vu36qnHQTLRYkDTdSpUBLc jMVqZ899svoerUOV9Efu4AaG0/jxTWoTP78joBBAvJeEBRykNY32gL1jWG1MTwFwZXcU xy2mT6yCtgjnWv4zH51heN1zOLsCP/XQ/1i/CNolY5W6R0cUtTBk51gfzjkya2inKpeB 4iFTURQ6hb1yDiymce3ofhdkw+YMB+Yd2r5alBET/eP6YFBJsF30ZAL/5piNaQiXTxxd k29ZYV6s0a+G5W03rxLiT4BWlq2ijAZDepd5N0M140xX5p/y8E4VpzBtC/x/8pgX2yWI kWHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XajuzfuW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a056402090800b0043567603f82si13956976edz.288.2022.06.27.17.05.29; Mon, 27 Jun 2022 17:05:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XajuzfuW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240361AbiF0XQ1 (ORCPT + 99 others); Mon, 27 Jun 2022 19:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241007AbiF0XQN (ORCPT ); Mon, 27 Jun 2022 19:16:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 274122314B; Mon, 27 Jun 2022 16:16:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79F51B818E7; Mon, 27 Jun 2022 23:16:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6F1EC34115; Mon, 27 Jun 2022 23:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656371765; bh=ZZxR+OcIIP15LVMw2BAXLSLMD60yYs8E8Q4+wsYIO4w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XajuzfuWiIfcsbh3IjCIoM307Q+UKJEC9KBc020DlCcH2wFSjol4qYB1KJ8/QVTJP XTLWiY1CZ8GypkwTk4tIoBn4tqy2L61/xPS7eBhGq0yAfuNB6EnMzMHvXL+glbGapa WoJ8HQeuMOU8i03SgkVr5nBSSHbtxwkcaTXsGWd5w1Qo2B6a1/vzDMUwNpcWCddmlC eKfrbPBw0tOtnPa941W9OAz+vgVojKN6s+Tog1/GgzulZGcCQpwc7/9TzmgUnstkXC rNRskplrnhAE5Y4m0QZ+FGAwXxzZNLSImHpYXC46oOL2huU7szpN9im1VMBvKfUfSh Coj4fotyAVxWw== Date: Tue, 28 Jun 2022 02:16:01 +0300 From: Jarkko Sakkinen To: Tianjia Zhang Cc: David Howells , David Woodhouse , keyrings@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 RESEND] sign-file: Fix confusing error messages Message-ID: References: <20220627092107.20994-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220627092107.20994-1-tianjia.zhang@linux.alibaba.com> X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 27, 2022 at 05:21:07PM +0800, Tianjia Zhang wrote: > When an error occurs, use errx() instead of err() to display the > error message, because openssl has its own error record. When an > error occurs, errno will not be changed, while err() displays the > errno error message. It will cause confusion. For example, when > CMS_add1_signer() fails, the following message will appear: > > sign-file: CMS_add1_signer: Success > > errx() ignores errno and does not cause such issue. > > Signed-off-by: Tianjia Zhang > --- > scripts/sign-file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/sign-file.c b/scripts/sign-file.c > index 7434e9ea926e..598ef5465f82 100644 > --- a/scripts/sign-file.c > +++ b/scripts/sign-file.c > @@ -114,7 +114,7 @@ static void drain_openssl_errors(void) > bool __cond = (cond); \ > display_openssl_errors(__LINE__); \ > if (__cond) { \ > - err(1, fmt, ## __VA_ARGS__); \ > + errx(1, fmt, ## __VA_ARGS__); \ > } \ > } while(0) > > -- > 2.24.3 (Apple Git-128) > Reviewed-by: Jarkko Sakkinen BR, Jarkko