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

Commit d514a3d0 authored by Alex Buynytskyy's avatar Alex Buynytskyy Committed by Android (Google) Code Review
Browse files

Merge "Make openWrite more resilient."

parents be03b36f f25cad29
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -107,10 +107,15 @@ final class ResilientAtomicFile implements Closeable {

        // In case of MT access, it's possible the files get overwritten during write.
        // Let's open all FDs we need now.
        try {
            mMainOutStream = new FileOutputStream(mFile);
            mMainInStream = new FileInputStream(mFile);
            mReserveOutStream = new FileOutputStream(mReserveCopy);
            mReserveInStream = new FileInputStream(mReserveCopy);
        } catch (IOException e) {
            close();
            throw e;
        }

        return mMainOutStream;
    }