Merge "add fsync when copy native libs" am: 32ad6e6d7f am: d49c7332a8 am: f5351ea3a2

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2252338

Change-Id: I007daa216e17c08b07f868db5b47b28610b3bbaa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Song Chun Fan
2022-10-14 22:30:25 +00:00
committed by Automerger Merge Worker

View File

@@ -257,6 +257,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.