Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Oct 2016 13:43:38 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r306808 - head/sbin/init
Message-ID:  <201610071343.u97Dhcc6048531@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610071343.u97Dhcc6048531>