mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
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.
This commit is contained in:
committed by
Linus Groh
parent
9e9a07415e
commit
a53749bc9d
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user