From 7b98704395c82fe42462b32bd9f6ef351deab5b4 Mon Sep 17 00:00:00 2001 From: bluhm Date: Sat, 19 Jul 2014 21:27:16 +0000 Subject: [PATCH] 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@ --- etc/rc | 9 +++++++-- 1 file 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 -- 2.20.1