summaryrefslogtreecommitdiffstats
path: root/etc/rc.d
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2007-03-03 06:39:06 +0000
committernjl <njl@FreeBSD.org>2007-03-03 06:39:06 +0000
commit56746aa8e0ffff51b371e72446368d6dbbe6b4ba (patch)
treeb22cdc500665eab569cc9161f4afcc34d0ff07f5 /etc/rc.d
parent3147a5f179b8dfcc05dabfbf9050c52cb7d998e0 (diff)
downloadFreeBSD-src-56746aa8e0ffff51b371e72446368d6dbbe6b4ba.zip
FreeBSD-src-56746aa8e0ffff51b371e72446368d6dbbe6b4ba.tar.gz
Get rid of chatter for failed commands if the filesystem is read-only.
Include /var/db/entropy-file in the reseeding if present. It is used for last-ditch efforts to save entropy and thus should also be used to seed the RNG when starting. Print a warning instead of an error if writing the file fails -- err() exits, preventing the umask from being restored. Also, since there's not much that can be done about it, notifying the user is all that's needed. MFC after: 2 weeks
Diffstat (limited to 'etc/rc.d')
-rw-r--r--etc/rc.d/random11
1 files changed, 6 insertions, 5 deletions
diff --git a/etc/rc.d/random b/etc/rc.d/random
index 7c72e55..160b1d4 100644
--- a/etc/rc.d/random
+++ b/etc/rc.d/random
@@ -45,6 +45,7 @@ random_start()
*)
if [ -w /dev/random ]; then
feed_dev_random "${entropy_file}"
+ feed_dev_random /var/db/entropy-file
fi
;;
esac
@@ -60,22 +61,22 @@ random_stop()
;;
*)
echo -n 'Writing entropy file:'
- rm -f ${entropy_file}
+ rm -f ${entropy_file} 2> /dev/null
oumask=`umask`
umask 077
- if touch ${entropy_file}; then
+ if touch ${entropy_file} 2> /dev/null; then
entropy_file_confirmed="${entropy_file}"
else
# Try this as a reasonable alternative for read-only
# roots, diskless workstations, etc.
- rm -f /var/db/entropy-file
- if touch /var/db/entropy-file; then
+ rm -f /var/db/entropy-file 2> /dev/null
+ if touch /var/db/entropy-file 2> /dev/null; then
entropy_file_confirmed=/var/db/entropy-file
fi
fi
case ${entropy_file_confirmed} in
'')
- err 1 'entropy file write failed.'
+ warn 'write failed (read-only fs?)'
;;
*)
dd if=/dev/random of=${entropy_file_confirmed} \
OpenPOWER on IntegriCloud