Re: [PATCH 06/13] setarch: print usage error if no argument given

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
> >
> > This looks more likely as intended.
> >
> > Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
> > ---
> >  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


--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux