ART: Fix Mmap reuse flag in vdex load
Only load with reuse=true if there's actually a map.
Follow-up to commit ec2cdf4286921131a5f9b3ed12060657ec40f636.
Bug: 71579677
Bug: 71804760
Test: m test-art-host
Change-Id: I1154942584becc4e8bb3873166479376916f2702
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 8548d2c..c666441 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -266,7 +266,7 @@
std::string* error_msg) {
vdex_ = VdexFile::OpenAtAddress(vdex_begin_,
vdex_end_ - vdex_begin_,
- true /* mmap_reuse */,
+ vdex_begin_ != nullptr /* mmap_reuse */,
vdex_filename,
writable,
low_4gb,
@@ -294,7 +294,7 @@
} else {
vdex_ = VdexFile::OpenAtAddress(vdex_begin_,
vdex_end_ - vdex_begin_,
- true /* mmap_reuse */,
+ vdex_begin_ != nullptr /* mmap_reuse */,
vdex_fd,
s.st_size,
vdex_filename,