diff --git a/Userland/Utilities/netstat.cpp b/Userland/Utilities/netstat.cpp index d86ddd9a9f..0b21706545 100644 --- a/Userland/Utilities/netstat.cpp +++ b/Userland/Utilities/netstat.cpp @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -154,13 +154,8 @@ ErrorOr serenity_main(Main::Arguments arguments) } if (!has_protocol_flag || flag_tcp) { - auto file = Core::File::construct("/sys/kernel/net/tcp"); - if (!file->open(Core::OpenMode::ReadOnly)) { - warnln("Error: {}", file->error_string()); - return 1; - } - - auto file_contents = file->read_all(); + auto file = TRY(Core::Stream::File::open("/sys/kernel/net/tcp"sv, Core::Stream::OpenMode::Read)); + auto file_contents = TRY(file->read_all()); auto json_or_error = JsonValue::from_string(file_contents); if (json_or_error.is_error()) { warnln("Error: {}", json_or_error.error()); @@ -251,8 +246,8 @@ ErrorOr serenity_main(Main::Arguments arguments) } if (!has_protocol_flag || flag_udp) { - auto file = TRY(Core::File::open("/sys/kernel/net/udp", Core::OpenMode::ReadOnly)); - auto file_contents = file->read_all(); + auto file = TRY(Core::Stream::File::open("/sys/kernel/net/udp"sv, Core::Stream::OpenMode::Read)); + auto file_contents = TRY(file->read_all()); auto json = TRY(JsonValue::from_string(file_contents)); Vector sorted_regions = json.as_array().values();