summaryrefslogtreecommitdiffstats
path: root/etc/rc
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>2000-07-24 13:40:41 +0000
committersheldonh <sheldonh@FreeBSD.org>2000-07-24 13:40:41 +0000
commit953536aee8132267edb329b981db18b2b61e8a72 (patch)
tree37f6962c55125876ac66c016c26143d03a3a726c /etc/rc
parent59635bcf3cc43cba7d70f88940b4dc0f1ebaf0b9 (diff)
downloadFreeBSD-src-953536aee8132267edb329b981db18b2b61e8a72.zip
FreeBSD-src-953536aee8132267edb329b981db18b2b61e8a72.tar.gz
If the initial attempt to write ${entropy_file} to /dev/random fails
and the randomdev.ko module is not resident, try to load the module and perform the write again. Reviewed by: markm
Diffstat (limited to 'etc/rc')
-rw-r--r--etc/rc12
1 files changed, 10 insertions, 2 deletions
diff --git a/etc/rc b/etc/rc
index 7b5b5f8..bea8bf4 100644
--- a/etc/rc
+++ b/etc/rc
@@ -138,9 +138,17 @@ case ${entropy_file} in
[Nn][Oo] | '')
;;
*)
- if [ -f ${entropy_file} -a -r ${entropy_file} ]; then
+ if [ -f ${entropy_file} -a -r ${entropy_file} -a -w /dev/random ]; then
echo "Reading entropy file"
- cat ${entropy_file} > /dev/random
+ if ! cat ${entropy_file} 2>/dev/null >/dev/random; then
+ if ! kldstat -n randomdev >/dev/null 2>&1; then
+ kldload randomdev && \
+ cat ${entropy_file} 2>/dev/null >/dev/random
+ fi
+ fi
+ if [ $? != 0 ]; then
+ echo "Writing entropy file to /dev/random failed"
+ fi
rm -f ${entropy_file}
fi
;;
OpenPOWER on IntegriCloud