svn commit: r308034 - stable/11/sbin/init
Konstantin Belousov
kib at FreeBSD.org
Fri Oct 28 12:55:15 UTC 2016
Author: kib
Date: Fri Oct 28 12:55:14 2016
New Revision: 308034
URL: https://svnweb.freebsd.org/changeset/base/308034
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/11/sbin/init/init.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sbin/init/init.c
==============================================================================
--- stable/11/sbin/init/init.c Fri Oct 28 12:46:38 2016 (r308033)
+++ stable/11/sbin/init/init.c Fri Oct 28 12:55:14 2016 (r308034)
@@ -870,6 +870,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;
@@ -1002,7 +1003,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");
More information about the svn-src-stable-11
mailing list