svn commit: r332075 - head/sbin/reboot

Rodney W. Grimes rgrimes at FreeBSD.org
Thu Apr 5 15:00:09 UTC 2018


Author: rgrimes
Date: Thu Apr  5 15:00:08 2018
New Revision: 332075
URL: https://svnweb.freebsd.org/changeset/base/332075

Log:
  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

Modified:
  head/sbin/reboot/reboot.c

Modified: head/sbin/reboot/reboot.c
==============================================================================
--- head/sbin/reboot/reboot.c	Thu Apr  5 14:55:44 2018	(r332074)
+++ head/sbin/reboot/reboot.c	Thu Apr  5 15:00:08 2018	(r332075)
@@ -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");


More information about the svn-src-all mailing list