aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/memory_mapped_file.cc
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2023-08-11 03:01:22 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-08-11 03:01:22 +0000
commitfe0b979764663486600861261cb885ba27aeb491 (patch)
treef98d11d6a158167e19fc9141c79d877280a616a6 /src/common/linux/memory_mapped_file.cc
parent8d0176459cfc11e28e9427a7eadcf7a42f654f62 (diff)
parent1317aa642182906c0d8ab5496dd3025632e22022 (diff)
downloadgoogle-breakpad-fe0b979764663486600861261cb885ba27aeb491.tar.gz
Upgrade google-breakpad to v2023.01.27 am: 332a4371ed am: c3c25b3748 am: 4e7c6460d7 am: c9c160dbfd am: 1317aa6421
Original change: https://android-review.googlesource.com/c/platform/external/google-breakpad/+/2704174 Change-Id: I1cb5f0b860fff4523f331cce12735979ae56fd20 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'src/common/linux/memory_mapped_file.cc')
-rw-r--r--src/common/linux/memory_mapped_file.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/common/linux/memory_mapped_file.cc b/src/common/linux/memory_mapped_file.cc
index 4e938269..7e444607 100644
--- a/src/common/linux/memory_mapped_file.cc
+++ b/src/common/linux/memory_mapped_file.cc
@@ -1,5 +1,4 @@
-// Copyright (c) 2011, Google Inc.
-// All rights reserved.
+// Copyright 2011 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -11,7 +10,7 @@
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
-// * Neither the name of Google Inc. nor the names of its
+// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
@@ -65,7 +64,8 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
}
#if defined(__x86_64__) || defined(__aarch64__) || \
- (defined(__mips__) && _MIPS_SIM == _ABI64)
+ (defined(__mips__) && _MIPS_SIM == _ABI64) || \
+ (defined(__riscv) && __riscv_xlen == 64)
struct kernel_stat st;
if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
@@ -87,13 +87,14 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
return true;
}
- void* data = sys_mmap(NULL, file_len, PROT_READ, MAP_PRIVATE, fd, offset);
+ size_t content_len = file_len - offset;
+ void* data = sys_mmap(NULL, content_len, PROT_READ, MAP_PRIVATE, fd, offset);
sys_close(fd);
if (data == MAP_FAILED) {
return false;
}
- content_.Set(data, file_len - offset);
+ content_.Set(data, content_len);
return true;
}