Author: kib
Date: Fri Oct 28 12:58:40 2016
New Revision: 308036
URL: https://svnweb.freebsd.org/changeset/base/308036

Log:
  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.

Modified:
  stable/10/sbin/init/init.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/init/init.c
==============================================================================
--- stable/10/sbin/init/init.c  Fri Oct 28 12:56:27 2016        (r308035)
+++ stable/10/sbin/init/init.c  Fri Oct 28 12:58:40 2016        (r308036)
@@ -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");
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to