From: millert Date: Fri, 3 Jan 2014 23:24:19 +0000 (+0000) Subject: Use kern.securelevel to determine whether or not we are in single X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=19b9ddfa02b27dac2df6434363438fe23bd686ed;p=openbsd 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@ --- diff --git a/etc/rc b/etc/rc index b3485af197b..971e3da92f3 100644 --- a/etc/rc +++ b/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