summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-10-28 12:58:40 +0000
committerkib <kib@FreeBSD.org>2016-10-28 12:58:40 +0000
commitd9adf64f1cc8a399091b95116269fd70f6d5992c (patch)
treefa30f19851e8f4fbf19fb5654242c78d8039854c /sbin
parent22e629294f23f8b34ef5a60d66dddd86d04253d9 (diff)
downloadFreeBSD-src-d9adf64f1cc8a399091b95116269fd70f6d5992c.zip
FreeBSD-src-d9adf64f1cc8a399091b95116269fd70f6d5992c.tar.gz
MFC r306807:
When making a pause after detecting hard kill of the single-user shell, ensure that we do sleep for at least the specified time, in presence of signals.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/init/init.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index af672a9..ba113c8 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -876,6 +876,7 @@ single_user(void)
sigset_t mask;
const char *shell;
char *argv[2];
+ struct timeval tv, tn;
#ifdef SECURE
struct ttyent *typ;
struct passwd *pp;
@@ -1008,7 +1009,14 @@ single_user(void)
* reboot(8) killed shell?
*/
warning("single user shell terminated.");
- sleep(STALL_TIMEOUT);
+ gettimeofday(&tv, NULL);
+ tn = tv;
+ tv.tv_sec += STALL_TIMEOUT;
+ while (tv.tv_sec > tn.tv_sec || (tv.tv_sec ==
+ tn.tv_sec && tv.tv_usec > tn.tv_usec)) {
+ sleep(1);
+ gettimeofday(&tn, NULL);
+ }
_exit(0);
} else {
warning("single user shell terminated, restarting");
OpenPOWER on IntegriCloud