mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
ntpquery: Fix pledge and unveil invocations
This commit is contained in:
parent
b1c73b3605
commit
7015c40905
Notes:
sideshowbarker
2024-07-17 16:23:55 +09:00
Author: https://github.com/demostanis Commit: https://github.com/SerenityOS/serenity/commit/7015c40905 Pull-request: https://github.com/SerenityOS/serenity/pull/15818 Reviewed-by: https://github.com/nico ✅
1 changed files with 6 additions and 4 deletions
|
@ -92,7 +92,10 @@ static String format_ntp_timestamp(NtpTimestamp ntp_timestamp)
|
|||
}
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio inet unix settime"));
|
||||
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;
|
||||
|
@ -121,7 +124,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
if (!adjust_time && !set_time) {
|
||||
TRY(Core::System::pledge("stdio inet unix"));
|
||||
TRY(Core::System::pledge("stdio inet unix rpath"));
|
||||
}
|
||||
|
||||
auto* hostent = gethostbyname(host);
|
||||
|
@ -130,8 +133,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
TRY(Core::System::pledge((adjust_time || set_time) ? "stdio inet settime"sv : "stdio inet"sv));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge((adjust_time || set_time) ? "stdio inet settime wpath rpath"sv : "stdio inet rpath"sv));
|
||||
|
||||
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (fd < 0) {
|
||||
|
|
Loading…
Reference in a new issue