From 05f4462266163d1f0c8dde8f7e4c62974f222d53 Mon Sep 17 00:00:00 2001 From: millert <> Date: Fri, 3 Jan 2014 23:24:19 +0000 Subject: [PATCH] Use kern.securelevel to determine whether or not we are in single user mode now that init no longer raises securelevel during reboot. OK deraadt@ --- src/etc/rc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/etc/rc b/src/etc/rc index b3485af1..971e3da9 100644 --- a/src/etc/rc +++ b/src/etc/rc @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.418 2013/12/28 01:00:18 deraadt Exp $ +# $OpenBSD: rc,v 1.419 2014/01/03 23:24:19 millert Exp $ # System startup script run by init on autoboot # or after single-user. @@ -232,11 +232,8 @@ fi if [ X"$1" = X"shutdown" ]; then random_seed - # XXX If root is writeable, assume we are not single user - chmod 600 /etc/random.seed >/dev/null 2>&1 - _notsingle=$? - - if [ ${_notsingle} -eq 0 ]; then + # If we are in secure level 0, assume single user mode. + if [ `sysctl -n kern.securelevel` -ne 0 ]; then if [ -n "${pkg_scripts}" ]; then echo -n 'stopping package daemons:' while [ -n "${pkg_scripts}" ]; do