summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-11-07 15:01:59 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-10 14:47:31 +0100
commit4512e891595580e36ad9093358f7baa0ea93b409 (patch)
tree76f2a665a5ed2efbb105cb35f2becb71f37f1eee
parent81b6be4bf4c65077d35a3446ba126586e86a85ea (diff)
downloadserenity-4512e891595580e36ad9093358f7baa0ea93b409.zip
strace: Interpret errno codes for pointer-like return codes
-rw-r--r--Userland/Utilities/strace.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Utilities/strace.cpp b/Userland/Utilities/strace.cpp
index b640393188..b4669fd856 100644
--- a/Userland/Utilities/strace.cpp
+++ b/Userland/Utilities/strace.cpp
@@ -386,7 +386,12 @@ public:
void format_result(void* res)
{
- m_builder.appendff(") = {}\n", res);
+ if (res == MAP_FAILED)
+ m_builder.append(") = MAP_FAILED\n");
+ else if (FlatPtr(res) > FlatPtr(-EMAXERRNO))
+ m_builder.appendff(") = {} {}\n", res, errno_name(-static_cast<int>(FlatPtr(res))));
+ else
+ m_builder.appendff(") = {}\n", res);
}
void format_result()