summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Song Chun Fan <schfan@google.com> 2022-10-14 20:54:04 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-10-14 20:54:04 +0000
commit32ad6e6d7fb8497f6e550099df7626f76e2f848e (patch)
treebb72cd2eeb1c9074140f86669a6782d4110ec509
parent8314a3e51bd31e9c11a9b61e4bef88b2ad65803d (diff)
parent6d235fba1e76e16265219c8cc8a729003dd62e19 (diff)
Merge "add fsync when copy native libs"
-rw-r--r--core/jni/com_android_internal_content_NativeLibraryHelper.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
index be82879c8411..0eb999f772d3 100644
--- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
+++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
@@ -260,6 +260,13 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr
return INSTALL_FAILED_CONTAINER_ERROR;
}
+ if (fsync(fd) < 0) {
+ ALOGE("Coulnd't fsync temporary file name: %s: %s\n", localTmpFileName, strerror(errno));
+ close(fd);
+ unlink(localTmpFileName);
+ return INSTALL_FAILED_INTERNAL_ERROR;
+ }
+
close(fd);
// Set the modification time for this file to the ZIP's mod time.