summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2016-08-09 21:23:16 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-08-09 21:23:16 +0200
commit8a4333f3b9e512796d3f9488d80a7815c0c29ac5 (patch)
tree8c539c482b906e30f04b7cc7f2c2e69b31ac6205
parentMerge "Fix references to libcrypto_utils_static." (diff)
parentHandle error from fopen_path in finish_recovery (diff)
downloadandroid_bootable_recovery-8a4333f3b9e512796d3f9488d80a7815c0c29ac5.tar
android_bootable_recovery-8a4333f3b9e512796d3f9488d80a7815c0c29ac5.tar.gz
android_bootable_recovery-8a4333f3b9e512796d3f9488d80a7815c0c29ac5.tar.bz2
android_bootable_recovery-8a4333f3b9e512796d3f9488d80a7815c0c29ac5.tar.lz
android_bootable_recovery-8a4333f3b9e512796d3f9488d80a7815c0c29ac5.tar.xz
android_bootable_recovery-8a4333f3b9e512796d3f9488d80a7815c0c29ac5.tar.zst
android_bootable_recovery-8a4333f3b9e512796d3f9488d80a7815c0c29ac5.zip
-rw-r--r--recovery.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 28dd212ba..7bdf961e7 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -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);
+ }
}
}