mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 03:15:07 +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:
parent
9e9a07415e
commit
a53749bc9d
1 changed files with 4 additions and 3 deletions
|
@ -93,9 +93,6 @@ static String format_ntp_timestamp(NtpTimestamp ntp_timestamp)
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
TRY(Core::System::pledge("stdio inet unix settime wpath rpath"));
|
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 adjust_time = false;
|
||||||
bool set_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.add_positional_argument(host, "NTP server", "host", Core::ArgsParser::Required::No);
|
||||||
args_parser.parse(arguments);
|
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) {
|
if (adjust_time && set_time) {
|
||||||
warnln("-a and -s are mutually exclusive");
|
warnln("-a and -s are mutually exclusive");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue