summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Harvyl <johan.harvyl@sonymobile.com>2016-08-09 22:04:17 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-08-09 22:04:17 +0200
commitd38ddde18130a3ea3324d14720fdf945522182ca (patch)
tree6e6a9f673d0a74a7efbf70bfcf2d4a7b67ef45fe
parentMerge "Fix references to libcrypto_utils_static." am: b97da5e0f0 am: dc97404346 (diff)
parentMerge "Handle error from fopen_path in finish_recovery" am: 8a4333f3b9 (diff)
downloadandroid_bootable_recovery-d38ddde18130a3ea3324d14720fdf945522182ca.tar
android_bootable_recovery-d38ddde18130a3ea3324d14720fdf945522182ca.tar.gz
android_bootable_recovery-d38ddde18130a3ea3324d14720fdf945522182ca.tar.bz2
android_bootable_recovery-d38ddde18130a3ea3324d14720fdf945522182ca.tar.lz
android_bootable_recovery-d38ddde18130a3ea3324d14720fdf945522182ca.tar.xz
android_bootable_recovery-d38ddde18130a3ea3324d14720fdf945522182ca.tar.zst
android_bootable_recovery-d38ddde18130a3ea3324d14720fdf945522182ca.zip
-rw-r--r--recovery.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/recovery.cpp b/recovery.cpp
index cfca9df6f..725976f9d 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -526,10 +526,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);
+ }
}
}