From 38ce053296c2870323e18f31a8932b53e30e52bc Mon Sep 17 00:00:00 2001 From: Liav A Date: Sat, 11 Feb 2023 17:42:43 +0200 Subject: [PATCH] Utilities/netstat: Don't unveil /tmp/portal/lookup for numerical output It's not needed in such case, and in the near-future when we would want to use this utility in an initramfs environment where there's no service such as LookupServer being running, it's still useful to have the option to invoke this utility with the mentioned limited output functionality. --- Userland/Utilities/netstat.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/netstat.cpp b/Userland/Utilities/netstat.cpp index 8f7e5ca45d..0f5038591e 100644 --- a/Userland/Utilities/netstat.cpp +++ b/Userland/Utilities/netstat.cpp @@ -48,7 +48,9 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/sys/kernel/processes", "r")); TRY(Core::System::unveil("/etc/passwd", "r")); TRY(Core::System::unveil("/etc/services", "r")); - TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); + if (!flag_numeric) + TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); + TRY(Core::System::unveil(nullptr, nullptr)); bool has_protocol_flag = (flag_tcp || flag_udp);