linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Mimi Zohar <zohar@kernel.org>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH 2/2] ima-evm-utils: Never exit with -1 code
Date: Tue, 30 Jul 2019 15:29:39 +0300	[thread overview]
Message-ID: <20190730122939.52jrwkl2xtdgh3os@altlinux.org> (raw)
In-Reply-To: <1564487830.4189.39.camel@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 <vt@altlinux.org>
> > ---
> >  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

  reply	other threads:[~2019-07-30 12:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-27  3:18 [PATCH 1/2] ima-evm-utils: Fix ima_verify return value on multiple files Vitaly Chikunov
2019-07-27  3:19 ` [PATCH 2/2] ima-evm-utils: Never exit with -1 code Vitaly Chikunov
2019-07-30 11:57   ` Mimi Zohar
2019-07-30 12:29     ` Vitaly Chikunov [this message]
2019-07-30 12:39       ` Vitaly Chikunov
2019-07-30 11:42 ` [PATCH 1/2] ima-evm-utils: Fix ima_verify return value on multiple files Mimi Zohar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190730122939.52jrwkl2xtdgh3os@altlinux.org \
    --to=vt@altlinux.org \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=zohar@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).