From: William Roberts <bill.c.roberts@gmail.com>
To: "Jokke Hämäläinen" <jokke.hamalainen@kolttonen.fi>,
"Daniel J Walsh" <dwalsh@redhat.com>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH] Global replace exit(0) with more readable exit(EXIT_SUCCESS)
Date: Wed, 15 May 2019 17:34:52 -0700 [thread overview]
Message-ID: <CAFftDdq5PF8Dx09a6SxtRhNkVH=L1a25HaK7ixhaJrf1VfyXtw@mail.gmail.com> (raw)
In-Reply-To: <CAFftDdrWTEXizp=BhcDBfKnh43uDX6dc_683EA_aO8aimpSo_g@mail.gmail.com>
merged: https://github.com/SELinuxProject/selinux/pull/148
On Fri, May 10, 2019 at 2:00 PM William Roberts
<bill.c.roberts@gmail.com> wrote:
>
> On Fri, May 10, 2019 at 12:03 PM Jokke Hämäläinen
> <jokke.hamalainen@kolttonen.fi> wrote:
> >
> >
> >
> > ---
> > libselinux/utils/avcstat.c | 4 ++--
> > libselinux/utils/compute_av.c | 2 +-
> > libselinux/utils/compute_create.c | 2 +-
> > libselinux/utils/compute_member.c | 2 +-
> > libselinux/utils/compute_relabel.c | 2 +-
> > libselinux/utils/compute_user.c | 4 ++--
> > libselinux/utils/getfilecon.c | 2 +-
> > libselinux/utils/getpidcon.c | 2 +-
> > libselinux/utils/getseuser.c | 2 +-
> > libselinux/utils/policyvers.c | 2 +-
> > libselinux/utils/setfilecon.c | 2 +-
> > 11 files changed, 13 insertions(+), 13 deletions(-)
> >
> > diff --git a/libselinux/utils/avcstat.c b/libselinux/utils/avcstat.c
> > index 884a10bf..da239287 100644
> > --- a/libselinux/utils/avcstat.c
> > +++ b/libselinux/utils/avcstat.c
> > @@ -116,7 +116,7 @@ int main(int argc, char **argv)
> > case 'h':
> > case '-':
> > usage();
> > - exit(0);
> > + exit(EXIT_SUCCESS);
>
> I wonder why this is exit success (as well as other spots)? Wouldn't
> something triggering usage be a fail unless they
> asked for usage()? Is that what - is doing ($ avcstat ----)? The man
> page doesn't mention it. Dan what was your thoughts here?
> I'm assuming you wrote it based on the man page and it seems to be
> included from Josh's initial import from SVN.
>
> > default:
> > usage();
> > die("unrecognized parameter '%c'", i);
> > @@ -133,7 +133,7 @@ int main(int argc, char **argv)
> > }
> > if (n == 0) {
> > usage();
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > interval = n;
> > }
> > diff --git a/libselinux/utils/compute_av.c b/libselinux/utils/compute_av.c
> > index 574fa6ed..df4a77e8 100644
> > --- a/libselinux/utils/compute_av.c
> > +++ b/libselinux/utils/compute_av.c
> > @@ -51,5 +51,5 @@ int main(int argc, char **argv)
> > printf("\n");
> > }
> >
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/compute_create.c b/libselinux/utils/compute_create.c
> > index 4abc29fb..449ccd90 100644
> > --- a/libselinux/utils/compute_create.c
> > +++ b/libselinux/utils/compute_create.c
> > @@ -32,5 +32,5 @@ int main(int argc, char **argv)
> >
> > printf("%s\n", buf);
> > freecon(buf);
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/compute_member.c b/libselinux/utils/compute_member.c
> > index 14edd451..c6dad19e 100644
> > --- a/libselinux/utils/compute_member.c
> > +++ b/libselinux/utils/compute_member.c
> > @@ -32,5 +32,5 @@ int main(int argc, char **argv)
> >
> > printf("%s\n", buf);
> > freecon(buf);
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/compute_relabel.c b/libselinux/utils/compute_relabel.c
> > index 970750e8..85c760bc 100644
> > --- a/libselinux/utils/compute_relabel.c
> > +++ b/libselinux/utils/compute_relabel.c
> > @@ -32,5 +32,5 @@ int main(int argc, char **argv)
> >
> > printf("%s\n", buf);
> > freecon(buf);
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/compute_user.c b/libselinux/utils/compute_user.c
> > index cae62b26..86d00a6e 100644
> > --- a/libselinux/utils/compute_user.c
> > +++ b/libselinux/utils/compute_user.c
> > @@ -27,12 +27,12 @@ int main(int argc, char **argv)
> >
> > if (!buf[0]) {
> > printf("none\n");
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> >
> > for (ptr = buf; *ptr; ptr++) {
> > printf("%s\n", *ptr);
> > }
> > freeconary(buf);
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/getfilecon.c b/libselinux/utils/getfilecon.c
> > index a7a51abb..6266ae16 100644
> > --- a/libselinux/utils/getfilecon.c
> > +++ b/libselinux/utils/getfilecon.c
> > @@ -23,5 +23,5 @@ int main(int argc, char **argv)
> > printf("%s\t%s\n", argv[i], buf);
> > freecon(buf);
> > }
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/getpidcon.c b/libselinux/utils/getpidcon.c
> > index 3df0da1f..ea6c274e 100644
> > --- a/libselinux/utils/getpidcon.c
> > +++ b/libselinux/utils/getpidcon.c
> > @@ -27,5 +27,5 @@ int main(int argc, char **argv)
> >
> > printf("%s\n", buf);
> > freecon(buf);
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/getseuser.c b/libselinux/utils/getseuser.c
> > index c33a4ad2..9193fe0a 100644
> > --- a/libselinux/utils/getseuser.c
> > +++ b/libselinux/utils/getseuser.c
> > @@ -36,5 +36,5 @@ int main(int argc, char **argv)
> > for (i = 0; i < n; i++)
> > printf("Context %d\t%s\n", i, contextlist[i]);
> > freeconary(contextlist);
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/policyvers.c b/libselinux/utils/policyvers.c
> > index 0309d7d1..dd56f2c7 100644
> > --- a/libselinux/utils/policyvers.c
> > +++ b/libselinux/utils/policyvers.c
> > @@ -14,5 +14,5 @@ int main(int argc __attribute__ ((unused)), char **argv)
> > }
> >
> > printf("%d\n", rc);
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > diff --git a/libselinux/utils/setfilecon.c b/libselinux/utils/setfilecon.c
> > index d69af84a..79af55de 100644
> > --- a/libselinux/utils/setfilecon.c
> > +++ b/libselinux/utils/setfilecon.c
> > @@ -20,5 +20,5 @@ int main(int argc, char **argv)
> > exit(2);
> > }
> > }
> > - exit(0);
> > + exit(EXIT_SUCCESS);
> > }
> > --
> > 2.21.0
> >
>
> ack on this as is, since it preserves behavior, but on the usage()
> case I wonder why
> some are not a failure.
prev parent reply other threads:[~2019-05-16 1:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-10 18:17 [PATCH] Global replace exit(0) with more readable exit(EXIT_SUCCESS) Jokke Hämäläinen
2019-05-10 21:00 ` William Roberts
2019-05-16 0:34 ` William Roberts [this message]
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='CAFftDdq5PF8Dx09a6SxtRhNkVH=L1a25HaK7ixhaJrf1VfyXtw@mail.gmail.com' \
--to=bill.c.roberts@gmail.com \
--cc=dwalsh@redhat.com \
--cc=jokke.hamalainen@kolttonen.fi \
--cc=selinux@vger.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).