summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Song Chun Fan <schfan@google.com> 2022-10-14 21:16:20 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-10-14 21:16:20 +0000
commitd49c7332a82ea8cef257682a703afe23b7381dbc (patch)
tree0c21b962469553e89077856ae0dcb69250165a17
parent37f46d5b02b5891e3147fd6ed00ae52ff378b6c3 (diff)
parent32ad6e6d7fb8497f6e550099df7626f76e2f848e (diff)
Merge "add fsync when copy native libs" am: 32ad6e6d7f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2252338 Change-Id: I3915fc69e93a072645cbc9b0279558f3ed123908 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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.