Index: libexec/rc/rc.d/random =================================================================== --- libexec/rc/rc.d/random +++ libexec/rc/rc.d/random @@ -25,7 +25,8 @@ for f ; do debug "saving entropy to $f" dd if=/dev/random of="$f" bs=4096 count=1 status=none && - chmod 600 "$f" + chmod 600 "$f" && + fsync "$f" "$(dirname "$f")" done umask ${oumask} } @@ -120,6 +121,9 @@ dd if=/dev/random of=${entropy_file_confirmed} \ bs=4096 count=1 2> /dev/null || warn 'write failed (unwriteable file or full fs?)' + fsync "${entropy_file_confirmed}" \ + "$(dirname "${entropy_file_confirmed}")" \ + 2> /dev/null echo '.' ;; esac @@ -145,6 +149,9 @@ dd if=/dev/random of=${entropy_boot_file_confirmed} \ bs=4096 count=1 2> /dev/null || warn 'write failed (unwriteable file or full fs?)' + fsync "${entropy_boot_file_confirmed}" \ + "$(dirname "${entropy_boot_file_confirmed}")" \ + 2> /dev/null echo '.' ;; esac Index: libexec/save-entropy/save-entropy.sh =================================================================== --- libexec/save-entropy/save-entropy.sh +++ libexec/save-entropy/save-entropy.sh @@ -80,6 +80,7 @@ while [ ${n} -ge 1 ]; do if [ -f "saved-entropy.${n}" ]; then mv "saved-entropy.${n}" "saved-entropy.$(( ${n} + 1 ))" + fsync . elif [ -e "saved-entropy.${n}" -o -L "saved-entropy.${n}" ]; then logger -is -t "$0" \ "${entropy_dir}/saved-entropy.${n}" is not a regular file, and so \ @@ -90,5 +91,6 @@ done dd if=/dev/random of=saved-entropy.1 bs=${entropy_save_sz} count=1 2>/dev/null +fsync saved-entropy.1 "." exit 0