Skip to content
Commit b1a77067 authored by Hai Zhang's avatar Hai Zhang
Browse files

Change AtomicFile to use rename-into-place.

The previous implementation of backing up beforehand doesn't handle
the case where the file is created for the first time, and might leave
a corrupted file in case of failure.

This new implementation creates a new file for writing data into, and
renames it into the place of the original file after writing
finished.

Fixes: 151959443
Test: atest android.util.AtomicFileTest
Change-Id: I5c4c438526a2aecdd2af18f71e16b41a05817c61
Merged-In: I5c4c438526a2aecdd2af18f71e16b41a05817c61
parent c8cd1ad5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment