Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 763006af authored by Elliott Hughes's avatar Elliott Hughes Committed by Android (Google) Code Review
Browse files

Merge "You can't fsync(2) /dev/urandom..."

parents dc5ba045 6907891b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ public class EntropyService extends Binder {

    private void loadInitialEntropy() {
        try {
            RandomBlock.fromFile(entropyFile).toFile(randomDevice);
            RandomBlock.fromFile(entropyFile).toFile(randomDevice, false);
        } catch (IOException e) {
            Slog.w(TAG, "unable to load initial entropy (first boot?)", e);
        }
@@ -104,7 +104,7 @@ public class EntropyService extends Binder {

    private void writeEntropy() {
        try {
            RandomBlock.fromFile(randomDevice).toFile(entropyFile);
            RandomBlock.fromFile(randomDevice).toFile(entropyFile, true);
        } catch (IOException e) {
            Slog.w(TAG, "unable to write entropy", e);
        }
+2 −2
Original line number Diff line number Diff line
@@ -62,11 +62,11 @@ class RandomBlock {
        return retval;
    }

    void toFile(String filename) throws IOException {
    void toFile(String filename, boolean sync) throws IOException {
        if (DEBUG) Slog.v(TAG, "writing to file " + filename);
        RandomAccessFile out = null;
        try {
            out = new RandomAccessFile(filename, "rws");
            out = new RandomAccessFile(filename, sync ? "rws" : "rw");
            toDataOut(out);
            truncateIfPossible(out);
        } finally {