diff options
author | kib <kib@FreeBSD.org> | 2016-10-28 12:58:40 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-10-28 12:58:40 +0000 |
commit | d9adf64f1cc8a399091b95116269fd70f6d5992c (patch) | |
tree | fa30f19851e8f4fbf19fb5654242c78d8039854c /sbin/init/init.c | |
parent | 22e629294f23f8b34ef5a60d66dddd86d04253d9 (diff) | |
download | FreeBSD-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/init/init.c')
-rw-r--r-- | sbin/init/init.c | 10 |
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"); |