From 4fce38ec78121b2c00e603f58a0159da7bd974e1 Mon Sep 17 00:00:00 2001 From: Nate Lawson Date: Sat, 3 Mar 2007 06:39:06 +0000 Subject: [PATCH] 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 --- etc/rc.d/random | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/etc/rc.d/random b/etc/rc.d/random index 7c72e5542b5..160b1d4a401 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} \