From fde9cba2a0710a68dbb6d7c089a0f43aabcb6e19 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 14 Sep 2022 17:40:25 +0100 Subject: [PATCH] Utilities/w: Port to Core::Stream --- Userland/Utilities/w.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Utilities/w.cpp b/Userland/Utilities/w.cpp index 6a30cd46d3..03bf9eefb0 100644 --- a/Userland/Utilities/w.cpp +++ b/Userland/Utilities/w.cpp @@ -7,8 +7,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -25,8 +25,9 @@ ErrorOr serenity_main(Main::Arguments) TRY(Core::System::unveil("/sys/kernel/processes", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto file = TRY(Core::File::open("/var/run/utmp", Core::OpenMode::ReadOnly)); - auto json = TRY(JsonValue::from_string(file->read_all())); + auto file = TRY(Core::Stream::File::open("/var/run/utmp"sv, Core::Stream::OpenMode::Read)); + auto file_contents = TRY(file->read_all()); + auto json = TRY(JsonValue::from_string(file_contents)); if (!json.is_object()) { warnln("Error: Could not parse /var/run/utmp"); return 1;