summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2014-07-19 21:27:16 +0000
committerbluhm <bluhm@openbsd.org>2014-07-19 21:27:16 +0000
commit7b98704395c82fe42462b32bd9f6ef351deab5b4 (patch)
treec2593443181a858633eaf267bff0696abab57c34
parentExplicitely check the value of REGRESS_SKIP_SLOW rather than its emptyness, (diff)
downloadwireguard-openbsd-7b98704395c82fe42462b32bd9f6ef351deab5b4.tar.xz
wireguard-openbsd-7b98704395c82fe42462b32bd9f6ef351deab5b4.zip
Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when the machine is rebooted from singe-user without mounting the file systems read-write. suggested by deraadt@
-rw-r--r--etc/rc9
1 files changed, 7 insertions, 2 deletions
diff --git a/etc/rc b/etc/rc
index 418c360291e..55cb691ee1b 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-# $OpenBSD: rc,v 1.436 2014/07/18 18:17:28 deraadt Exp $
+# $OpenBSD: rc,v 1.437 2014/07/19 21:27:16 bluhm Exp $
# System startup script run by init on autoboot
# or after single-user.
@@ -267,7 +267,12 @@ FUNCS_ONLY=1 . /etc/rc.d/rc.subr
_rc_parse_conf
if [ X"$1" = X"shutdown" ]; then
- random_seed
+ if echo 2>/dev/null >>/var/db/host.random || \
+ echo 2>/dev/null >>/etc/random.seed; then
+ random_seed
+ else
+ echo warning: cannot write random seed to disk
+ fi
# If we are in secure level 0, assume single user mode.
if [ `sysctl -n kern.securelevel` -ne 0 ]; then