svn commit: r306808 - head/sbin/init

Konstantin Belousov kib at FreeBSD.org
Fri Oct 7 13:43:39 UTC 2016


Author: kib
Date: Fri Oct  7 13:43:38 2016
New Revision: 306808
URL: https://svnweb.freebsd.org/changeset/base/306808

Log:
  Add verbosity around failed reboot(2) call.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	3 weeks

Modified:
  head/sbin/init/init.c

Modified: head/sbin/init/init.c
==============================================================================
--- head/sbin/init/init.c	Fri Oct  7 13:41:28 2016	(r306807)
+++ head/sbin/init/init.c	Fri Oct  7 13:43:38 2016	(r306808)
@@ -885,8 +885,13 @@ single_user(void)
 	if (Reboot) {
 		/* Instead of going single user, let's reboot the machine */
 		sync();
-		reboot(howto);
-		_exit(0);
+		if (reboot(howto) == -1) {
+			emergency("reboot(%#x) failed, %s", howto,
+			    strerror(errno));
+			_exit(1); /* panic and reboot */
+		}
+		warning("reboot(%#x) returned", howto);
+		_exit(0); /* panic as well */
 	}
 
 	shell = get_shell();


More information about the svn-src-head mailing list