From c7e5ef30572b3ec732d76200eab10c166c9594be Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 7 May 2021 22:06:58 +0200 Subject: [PATCH] strace: Stop using Core::IODevice::printf() There are no other clients of this weird API, so let's get rid of it. Now that we call IODevice::write() instead, we can also handle errors. --- Userland/Utilities/strace.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Userland/Utilities/strace.cpp b/Userland/Utilities/strace.cpp index 7bd6e5fdef..545d937da6 100644 --- a/Userland/Utilities/strace.cpp +++ b/Userland/Utilities/strace.cpp @@ -148,13 +148,17 @@ int main(int argc, char** argv) u32 res = regs.eax; - trace_file->printf("%s(0x%x, 0x%x, 0x%x)\t=%d\n", - Syscall::to_string( - (Syscall::Function)syscall_index), + auto string = String::formatted("{}({:#08x}, {:#08x}, {:#08x})\t={}\n", + Syscall::to_string((Syscall::Function)syscall_index), arg1, arg2, arg3, res); + + if (!trace_file->write(string)) { + warnln("write: {}", trace_file->error_string()); + return 1; + } } return 0;