From 2e23ded5c400a9b398ae07e70a5b443c4dc1ba6c Mon Sep 17 00:00:00 2001 From: "Rodney W. Grimes" Date: Thu, 5 Apr 2018 15:00:08 +0000 Subject: [PATCH] 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 --- sbin/reboot/reboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index 87abb651744..28b84ff25bc 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -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");