summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorJohan Harvyl <johan.harvyl@sonymobile.com>2016-08-09 21:50:15 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-08-09 21:50:15 +0200
commita550ee0df7abe3e090cea2570ec9c302856bc72f (patch)
tree1ba2f46b00326f71c9ef9c3ad144aac4153b0dde /recovery.cpp
parentMerge "Fix references to libcrypto_utils_static." (diff)
parentMerge "Handle error from fopen_path in finish_recovery" (diff)
downloadandroid_bootable_recovery-a550ee0df7abe3e090cea2570ec9c302856bc72f.tar
android_bootable_recovery-a550ee0df7abe3e090cea2570ec9c302856bc72f.tar.gz
android_bootable_recovery-a550ee0df7abe3e090cea2570ec9c302856bc72f.tar.bz2
android_bootable_recovery-a550ee0df7abe3e090cea2570ec9c302856bc72f.tar.lz
android_bootable_recovery-a550ee0df7abe3e090cea2570ec9c302856bc72f.tar.xz
android_bootable_recovery-a550ee0df7abe3e090cea2570ec9c302856bc72f.tar.zst
android_bootable_recovery-a550ee0df7abe3e090cea2570ec9c302856bc72f.zip
Diffstat (limited to 'recovery.cpp')
-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);
+ }
}
}