From 4b1e501bdfd4bad98b140ed7bcbfac01aa4e5e80 Mon Sep 17 00:00:00 2001 From: Liav A Date: Sun, 12 Feb 2023 22:21:01 +0200 Subject: [PATCH] Utilities/arp: 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/arp.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Userland/Utilities/arp.cpp b/Userland/Utilities/arp.cpp index bb1315f4ae..066474b46b 100644 --- a/Userland/Utilities/arp.cpp +++ b/Userland/Utilities/arp.cpp @@ -28,9 +28,6 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio rpath tty inet unix")); - TRY(Core::System::unveil("/sys/kernel/net/arp", "r")); - TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); - TRY(Core::System::unveil(nullptr, nullptr)); static bool flag_set; static bool flag_delete; @@ -47,6 +44,12 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_positional_argument(value_hw_address, "Hardware address", "hwaddress", Core::ArgsParser::Required::No); args_parser.parse(arguments); + TRY(Core::System::unveil("/sys/kernel/net/arp", "r")); + if (!flag_numeric) + TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); + + TRY(Core::System::unveil(nullptr, nullptr)); + enum class Alignment { Left, Right