From: Mark Wielaard <mark@klomp.org>
To: "Dmitry V. Levin" <ldv@altlinux.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] elfcompress: fix exit status in case of an error
Date: Wed, 12 May 2021 23:13:08 +0200 [thread overview]
Message-ID: <YJxE5MabEM5KzgDc@wildebeest.org> (raw)
In-Reply-To: <20210512203527.GA7746@altlinux.org>
Hi Dmitry,
On Wed, May 12, 2021 at 11:35:27PM +0300, Dmitry V. Levin wrote:
> On Wed, May 12, 2021 at 10:29:33PM +0200, Mark Wielaard wrote:
> > On Wed, May 12, 2021 at 04:00:00PM +0000, Dmitry V. Levin wrote:
> > > Exit status of 255 in case of an error is probably not what elfcompress
> > > users expect, change it to 1.
> > >
> > > Reported-by: Vitaly Chikunov <vt@altlinux.org>
> > > Fixes: 92acb57eb046 ("elfcompress: New utility.")
> > > [...]
> > > diff --git a/src/elfcompress.c b/src/elfcompress.c
> > > index 05f3bc2c..dacaff32 100644
> > > --- a/src/elfcompress.c
> > > +++ b/src/elfcompress.c
> > > @@ -1358,5 +1358,5 @@ main (int argc, char **argv)
> > > while (++remaining < argc);
> > >
> > > free_patterns ();
> > > - return result;
> > > + return !!result;
> > > }
> >
> > The change to return 1 (or zero) is good.
> >
> > But could we instead initialize res to 1
>
> That is, change process_file() to return 1 (or EXIT_FAILURE)
> instead of -1 in case of an error?
Yes. I admit I assumed this was already in process_file. But this is
really just a nitpick because I always get confused when reading the
!! pattern. The important part returning zero or one from main.
Thanks,
Mark
next prev parent reply other threads:[~2021-05-12 21:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-12 16:00 Dmitry V. Levin
2021-05-12 20:29 ` Mark Wielaard
2021-05-12 20:35 ` Dmitry V. Levin
2021-05-12 21:13 ` Mark Wielaard [this message]
2021-05-12 21:52 ` [PATCH v2] " Dmitry V. Levin
2021-05-13 13:44 ` Mark Wielaard
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=YJxE5MabEM5KzgDc@wildebeest.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
--cc=ldv@altlinux.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 read-only IMAP folder(s) and NNTP newsgroup(s).