util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ruediger Meier <sweet_f_a@gmx.de>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 06/13] setarch: print usage error if no argument given
Date: Thu, 22 Jun 2017 10:44:58 +0200	[thread overview]
Message-ID: <201706221044.59203.sweet_f_a@gmx.de> (raw)
In-Reply-To: <20170622083824.hqgqykwccfb7jmbb@ws.net.home>

On Thursday 22 June 2017, Karel Zak wrote:
> On Thu, Jun 22, 2017 at 04:37:39AM +0200, Ruediger Meier wrote:
> > From: Ruediger Meier <ruediger.meier@ga-group.nl>
> >
> > This looks more likely as intended.
> >
> > Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
> > ---
> >  sys-utils/setarch.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
> > index eb9cf21..6481eb2 100644
> > --- a/sys-utils/setarch.c
> > +++ b/sys-utils/setarch.c
> > @@ -301,7 +301,7 @@ int main(int argc, char *argv[])
> >  	textdomain(PACKAGE);
> >  	atexit(close_stdout);
> >
> > -	if (argc < 1)
> > +	if (argc < 2)
> >  		show_usage(_("Not enough arguments"));
>
> I don't think so.
>
> We use setarch by symlinks (i386, uname26 linux32 linux64, ...) and
> in this case it's executed without argument. The symlink name is good
> enough.
>
> The right solutions is to remove this entire if() block.

Maybe argc can be 0 when not invoked from a sane shell
https://stackoverflow.com/questions/2794150/when-can-argv0-have-null

Just skip this patch, I will update this on github later.


> Later in the code we have "no architecture argument specified".
>
>
>     Karel

  reply	other threads:[~2017-06-22  8:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22  2:37 [PATCH 00/13] usage cleanup part 1 Ruediger Meier
2017-06-22  2:37 ` [PATCH 01/13] uuidd: remove unused define Ruediger Meier
2017-06-22  2:37 ` [PATCH 02/13] misc: remove superfluous null pointer checks for optarg Ruediger Meier
2017-06-22  2:37 ` [PATCH 03/13] misc: fix some broken exit codes Ruediger Meier
2017-06-22 20:49   ` Ruediger Meier
2017-06-22  2:37 ` [PATCH 04/13] blkid: use errtryhelp instead of errtryh Ruediger Meier
2017-06-22  2:37 ` [PATCH 05/13] dmesg: do not accept any non-option arguments Ruediger Meier
2017-06-22  2:37 ` [PATCH 06/13] setarch: print usage error if no argument given Ruediger Meier
2017-06-22  8:38   ` Karel Zak
2017-06-22  8:44     ` Ruediger Meier [this message]
2017-06-22  2:37 ` [PATCH 07/13] setarch: use errtryhelp() Ruediger Meier
2017-06-22  2:37 ` [PATCH 08/13] fsck: add --help and --version Ruediger Meier
2017-06-22  2:37 ` [PATCH 09/13] login: " Ruediger Meier
2017-06-22  8:42   ` Karel Zak
2017-06-22  2:37 ` [PATCH 10/13] whereis: " Ruediger Meier
2017-06-22  2:37 ` [PATCH 11/13] more: " Ruediger Meier
2017-06-22  2:37 ` [PATCH 12/13] mkfs.cramfs: " Ruediger Meier
2017-06-22  2:37 ` [PATCH 13/13] misc: no more errtryh() Ruediger Meier
2017-06-26 13:04 ` [PATCH 00/13] usage cleanup part 1 Rüdiger Meier
2017-06-26 14:07   ` Karel Zak
2017-06-26 14:44     ` Rüdiger Meier
2017-06-26 20:37       ` Karel Zak

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=201706221044.59203.sweet_f_a@gmx.de \
    --to=sweet_f_a@gmx.de \
    --cc=kzak@redhat.com \
    --cc=util-linux@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).