diff options
| author | Conrad Meyer <cem@FreeBSD.org> | 2019-03-31 04:57:50 +0000 |
|---|---|---|
| committer | Conrad Meyer <cem@FreeBSD.org> | 2019-03-31 04:57:50 +0000 |
| commit | c849485d9061ee5c7e975ba7cef93f3361a8e7ad (patch) | |
| tree | 0fb3f9402dc971ab653734bfa0ee221a116007c6 /libexec | |
| parent | f0645b3a06b82f6dc46a35d707a68e0e120b12c1 (diff) | |
Notes
Diffstat (limited to 'libexec')
| -rwxr-xr-x | libexec/rc/rc.d/random | 9 | ||||
| -rwxr-xr-x | libexec/save-entropy/save-entropy.sh | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libexec/rc/rc.d/random b/libexec/rc/rc.d/random index 9762c9d3bfdd1..b144923c4701b 100755 --- a/libexec/rc/rc.d/random +++ b/libexec/rc/rc.d/random @@ -25,7 +25,8 @@ save_dev_random() 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 @@ random_stop() 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 @@ random_stop() 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 diff --git a/libexec/save-entropy/save-entropy.sh b/libexec/save-entropy/save-entropy.sh index 053a031a7f023..6a5e7cdd38a09 100755 --- a/libexec/save-entropy/save-entropy.sh +++ b/libexec/save-entropy/save-entropy.sh @@ -90,5 +90,6 @@ while [ ${n} -ge 1 ]; do done dd if=/dev/random of=saved-entropy.1 bs=${entropy_save_sz} count=1 2>/dev/null +fsync saved-entropy.1 "." exit 0 |
