summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Harvyl <johan.harvyl@sonymobile.com>2016-08-09 21:55:43 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-08-09 21:55:43 +0200
commitb33a6f8342b35a514bee6d434f440c65f956d9c7 (patch)
treee0eade123719a6d8254b618cbdca4979698bcfca
parentMerge "Fix references to libcrypto_utils_static." am: b97da5e0f0 (diff)
parentMerge "Handle error from fopen_path in finish_recovery" (diff)
downloadandroid_bootable_recovery-b33a6f8342b35a514bee6d434f440c65f956d9c7.tar
android_bootable_recovery-b33a6f8342b35a514bee6d434f440c65f956d9c7.tar.gz
android_bootable_recovery-b33a6f8342b35a514bee6d434f440c65f956d9c7.tar.bz2
android_bootable_recovery-b33a6f8342b35a514bee6d434f440c65f956d9c7.tar.lz
android_bootable_recovery-b33a6f8342b35a514bee6d434f440c65f956d9c7.tar.xz
android_bootable_recovery-b33a6f8342b35a514bee6d434f440c65f956d9c7.tar.zst
android_bootable_recovery-b33a6f8342b35a514bee6d434f440c65f956d9c7.zip
-rw-r--r--recovery.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/recovery.cpp b/recovery.cpp
index a3c4053c1..88fedc857 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -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);
+ }
}
}