mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 12:19:37 +03:00
NetworkServer: Kill running DHCPServer before starting our own
We cannot run two DHCPServers at once, let's just kill the one that was started previously.
This commit is contained in:
parent
8526c3f680
commit
df7b7cbfa4
Notes:
sideshowbarker
2024-07-17 09:34:40 +09:00
Author: https://github.com/sppmacd Commit: https://github.com/SerenityOS/serenity/commit/df7b7cbfa4 Pull-request: https://github.com/SerenityOS/serenity/pull/13259 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/IdanHo
@ -22,6 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
||||
TRY(Core::System::unveil("/bin/DHCPClient", "x"));
|
||||
TRY(Core::System::unveil("/etc/Network.ini", "r"));
|
||||
TRY(Core::System::unveil("/bin/ifconfig", "x"));
|
||||
TRY(Core::System::unveil("/bin/killall", "x"));
|
||||
TRY(Core::System::unveil("/bin/route", "x"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
@ -88,6 +89,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
||||
for (auto& iface : interfaces_with_dhcp_enabled)
|
||||
args.append(const_cast<char*>(iface.characters()));
|
||||
args.append(nullptr);
|
||||
MUST(Core::command("killall", { "DHCPClient" }, {}));
|
||||
auto dhcp_client_pid = TRY(Core::System::posix_spawnp("DHCPClient", nullptr, nullptr, args.data(), environ));
|
||||
TRY(Core::System::disown(dhcp_client_pid));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user