diff options
-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"); |