Exit with usage when extra arguments are on command line

preventing mistakes such as "halt 0p" for "halt -p".
Approved by:	bde (mentor), phk (mentor)
MFC after:	1 week
This commit is contained in:
Rodney W. Grimes 2018-04-05 15:00:08 +00:00
parent 9dba82a442
commit 2e23ded5c4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332075

View file

@ -116,6 +116,8 @@ main(int argc, char *argv[])
}
argc -= optind;
argv += optind;
if (argc != 0)
usage();
if ((howto & (RB_DUMP | RB_HALT)) == (RB_DUMP | RB_HALT))
errx(1, "cannot dump (-d) when halting; must reboot instead");