summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-10-31 15:46:51 -0400
committerLinus Groh <mail@linusgroh.de>2022-10-31 22:10:14 +0000
commita53749bc9dcad98a6102550a069108e53db59fd1 (patch)
tree7e6ebe33e61b86871b55d70c395c6441ad4e6c4a /Userland
parent9e9a07415e69bb09ed3de9612ddaf75bf3a8f610 (diff)
downloadserenity-a53749bc9dcad98a6102550a069108e53db59fd1.zip
ntpquery: Unveil paths after parsing arguments
This allows running `ntpquery --help` in environments that do not have the LookupServer service running, e.g. when generating man pages. The same was done for netstat in commit 7fba413.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Utilities/ntpquery.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Utilities/ntpquery.cpp b/Userland/Utilities/ntpquery.cpp
index d3aff6049a..1cc94ac374 100644
--- a/Userland/Utilities/ntpquery.cpp
+++ b/Userland/Utilities/ntpquery.cpp
@@ -93,9 +93,6 @@ static String format_ntp_timestamp(NtpTimestamp ntp_timestamp)
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
TRY(Core::System::pledge("stdio inet unix settime wpath rpath"));
- TRY(Core::System::unveil("/tmp/portal/lookup", "rw"));
- TRY(Core::System::unveil("/etc/timezone", "r"));
- TRY(Core::System::unveil(nullptr, nullptr));
bool adjust_time = false;
bool set_time = false;
@@ -118,6 +115,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_positional_argument(host, "NTP server", "host", Core::ArgsParser::Required::No);
args_parser.parse(arguments);
+ TRY(Core::System::unveil("/tmp/portal/lookup", "rw"));
+ TRY(Core::System::unveil("/etc/timezone", "r"));
+ TRY(Core::System::unveil(nullptr, nullptr));
+
if (adjust_time && set_time) {
warnln("-a and -s are mutually exclusive");
return 1;