Merge "Handle error from fopen_path in finish_recovery"

This commit is contained in:
Treehugger Robot
2016-08-09 19:23:16 +00:00
committed by Gerrit Code Review

View File

@@ -504,10 +504,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);
}
}
}