summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Harvyl <johan.harvyl@sonymobile.com>2016-08-09 22:07:26 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-08-09 22:07:26 +0200
commit462324b655083efb96765b02cf1a0708cf9c079e (patch)
treeaf202fc35500ecc8837b023c6ee3b6224ebda7f1
parentMerge "Fix references to libcrypto_utils_static." am: b97da5e0f0 am: dc97404346 am: e6a4195bf7 (diff)
parentMerge "Handle error from fopen_path in finish_recovery" am: 8a4333f3b9 am: a550ee0df7 (diff)
downloadandroid_bootable_recovery-462324b655083efb96765b02cf1a0708cf9c079e.tar
android_bootable_recovery-462324b655083efb96765b02cf1a0708cf9c079e.tar.gz
android_bootable_recovery-462324b655083efb96765b02cf1a0708cf9c079e.tar.bz2
android_bootable_recovery-462324b655083efb96765b02cf1a0708cf9c079e.tar.lz
android_bootable_recovery-462324b655083efb96765b02cf1a0708cf9c079e.tar.xz
android_bootable_recovery-462324b655083efb96765b02cf1a0708cf9c079e.tar.zst
android_bootable_recovery-462324b655083efb96765b02cf1a0708cf9c079e.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);
+ }
}
}