1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

LookupServer: Watch /etc/hosts for changes during runtime

This adds a FileWatcher to the LookupServer which watches '/etc/hosts'
for changes during runtime and reloads its contents. If the file is
deleted, m_etc_hosts will be cleared.

Since we now need to access '/etc/hosts' later during runtime, it needs
to be unveiled with read permissions.
This commit is contained in:
Max Wipfli 2021-06-07 20:26:09 +02:00 committed by Ali Mohammad Pur
parent 7b39db3bf4
commit 4efccbd030
3 changed files with 31 additions and 0 deletions

View file

@ -30,6 +30,11 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
return 1;
}
if (unveil("/etc/hosts", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;