Merge "add fsync when copy native libs"

This commit is contained in:
Song Chun Fan
2022-10-14 20:54:04 +00:00
committed by Gerrit Code Review

View File

@@ -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.