summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-03-10 20:02:48 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-11 12:32:53 +0100
commit798dea7a4964b08b9aeec2e68183819262b40daf (patch)
tree546f80568cab9e18ea0176db0620c06f36d902c4
parentbceb98e2df5f6030b4a95ad7d874e8a4c59f4026 (diff)
downloadserenity-798dea7a4964b08b9aeec2e68183819262b40daf.zip
crash: Fix typo in check logic
The remainder of the code assumes that the mmap was successful, so the 'unexpected error' case is that we see MAP_FAILED.
-rw-r--r--Userland/Utilities/crash.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Utilities/crash.cpp b/Userland/Utilities/crash.cpp
index 817dbc300e..cb9cad0cbf 100644
--- a/Userland/Utilities/crash.cpp
+++ b/Userland/Utilities/crash.cpp
@@ -238,7 +238,7 @@ int main(int argc, char** argv)
if (do_write_to_read_only_memory || do_all_crash_types) {
Crash("Write to read only memory", []() {
auto* ptr = (u8*)mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_ANON, 0, 0);
- if (ptr != MAP_FAILED)
+ if (ptr == MAP_FAILED)
return Crash::Failure::UnexpectedError;
*ptr = 'x'; // This should work fine.