From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9EE0C433FF for ; Tue, 30 Jul 2019 12:29:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B865C206E0 for ; Tue, 30 Jul 2019 12:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729497AbfG3M3m (ORCPT ); Tue, 30 Jul 2019 08:29:42 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:54458 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728186AbfG3M3m (ORCPT ); Tue, 30 Jul 2019 08:29:42 -0400 Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id 2E58472CCD5; Tue, 30 Jul 2019 15:29:40 +0300 (MSK) Received: from altlinux.org (sole.flsd.net [185.75.180.6]) by imap.altlinux.org (Postfix) with ESMTPSA id 07DBD4A4AE7; Tue, 30 Jul 2019 15:29:40 +0300 (MSK) Date: Tue, 30 Jul 2019 15:29:39 +0300 From: Vitaly Chikunov To: Mimi Zohar Cc: Dmitry Kasatkin , linux-integrity@vger.kernel.org Subject: Re: [PATCH 2/2] ima-evm-utils: Never exit with -1 code Message-ID: <20190730122939.52jrwkl2xtdgh3os@altlinux.org> Mail-Followup-To: Mimi Zohar , Dmitry Kasatkin , linux-integrity@vger.kernel.org References: <20190727031900.7140-1-vt@altlinux.org> <20190727031900.7140-2-vt@altlinux.org> <1564487830.4189.39.camel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <1564487830.4189.39.camel@kernel.org> User-Agent: NeoMutt/20171215-106-ac61c7 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org Mimi, On Tue, Jul 30, 2019 at 07:57:10AM -0400, Mimi Zohar wrote: > On Sat, 2019-07-27 at 06:19 +0300, Vitaly Chikunov wrote: > > Change main() return code from -1 to 125 as -1 is not really valid exit > > code. 125 is choosen because exit codes for signals start from 126. > > > > Signed-off-by: Vitaly Chikunov > > --- > > src/evmctl.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/src/evmctl.c b/src/evmctl.c > > index d33a91e..e0a835f 100644 > > --- a/src/evmctl.c > > +++ b/src/evmctl.c > > @@ -2100,6 +2100,8 @@ int main(int argc, char *argv[]) > > break; > > log_err("%s\n", ERR_error_string(error, NULL)); > > } > > + if (err < 0) > > + err = 125; > > } > > > > if (eng) { > > Agreed we need to return better errors, but instead of always > returning 125, would it be better to return the first errno, if err is > -1? 125 will be not always but only to avoid returning -1 (or any negative). There is no practice to exit with errno, AFAIK. Plus, errno we have at the end (and which is reported to user) frequently is bogus and that should be fixed. (I may do this later maybe, don't know how much work that would require). We also wish to reserve some exit code as hard error for tests. Thanks, > > Mimi