Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: third_party/crashpad/crashpad/util/posix/signals_test.cc

Issue 2804713002: Update Crashpad to b4095401639ebe2ad33169e5c1d994065cbff1b8 (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/util/posix/signals_test.cc
diff --git a/third_party/crashpad/crashpad/util/posix/signals_test.cc b/third_party/crashpad/crashpad/util/posix/signals_test.cc
index 7d4fb7562e2a51b69dbb6f8a90ede9ecdad7b1e5..5fce38ccf52e25438d8d605f05ba73ab67c2e69b 100644
--- a/third_party/crashpad/crashpad/util/posix/signals_test.cc
+++ b/third_party/crashpad/crashpad/util/posix/signals_test.cc
@@ -17,7 +17,6 @@
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
@@ -33,6 +32,7 @@
#include "test/errors.h"
#include "test/multiprocess.h"
#include "test/scoped_temp_dir.h"
+#include "util/posix/scoped_mmap.h"
namespace crashpad {
namespace test {
@@ -84,7 +84,7 @@ void CauseSignal(int sig) {
}
case SIGBUS: {
- char* mapped;
+ ScopedMmap mapped_file;
{
base::ScopedFD fd;
{
@@ -100,21 +100,17 @@ void CauseSignal(int sig) {
_exit(kUnexpectedExitStatus);
}
- mapped = reinterpret_cast<char*>(mmap(nullptr,
- getpagesize(),
- PROT_READ | PROT_WRITE,
- MAP_PRIVATE,
- fd.get(),
- 0));
- if (mapped == MAP_FAILED) {
- PLOG(ERROR) << "mmap";
+ if (!mapped_file.ResetMmap(nullptr,
+ getpagesize(),
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE,
+ fd.get(),
+ 0)) {
+ _exit(kUnexpectedExitStatus);
}
}
- if (mapped == MAP_FAILED) {
- _exit(kUnexpectedExitStatus);
- }
- *mapped = 0;
+ *mapped_file.addr_as<char*>() = 0;
_exit(kUnexpectedExitStatus);
break;
@@ -276,7 +272,7 @@ class SignalsTest : public Multiprocess {
sigemptyset(&action.sa_mask);
action.sa_flags = 0;
action.sa_handler = SIG_DFL;
- ASSERT_EQ(0, sigaction(sig_, &action, nullptr))
+ ASSERT_EQ(sigaction(sig_, &action, nullptr), 0)
<< ErrnoMessage("sigaction");
break;
}
@@ -351,8 +347,8 @@ TEST(Signals, WillSignalReraiseAutonomously) {
siginfo_t siginfo = {};
siginfo.si_signo = test_data.sig;
siginfo.si_code = test_data.code;
- EXPECT_EQ(test_data.result,
- Signals::WillSignalReraiseAutonomously(&siginfo));
+ EXPECT_EQ(Signals::WillSignalReraiseAutonomously(&siginfo),
+ test_data.result);
}
}

Powered by Google App Engine
This is Rietveld 408576698