Merge "Handle error from fopen_path in finish_recovery"

am: 8a4333f3b9

Change-Id: I9225bcbe1ed82a63f70c7c6a984fd043ac77100b
This commit is contained in:
Johan Harvyl
2016-08-09 19:50:15 +00:00
committed by android-build-merger

View File

@@ -510,10 +510,12 @@ finish_recovery() {
if (has_cache) {
LOGI("Saving locale \"%s\"\n", locale);
FILE* fp = fopen_path(LOCALE_FILE, "w");
fwrite(locale, 1, len, fp);
fflush(fp);
fsync(fileno(fp));
check_and_fclose(fp, LOCALE_FILE);
if (fp != NULL) {
fwrite(locale, 1, len, fp);
fflush(fp);
fsync(fileno(fp));
check_and_fclose(fp, LOCALE_FILE);
}
}
}