From e10037df2c438d4975ff0f24df9b3ad4edc464f0 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 7 Oct 2016 13:43:38 +0000 Subject: [PATCH] Add verbosity around failed reboot(2) call. Sponsored by: The FreeBSD Foundation MFC after: 3 weeks --- sbin/init/init.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 24785fe827a3..25ac2bd63901 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -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();