diff options
author | Maciej <sppmacd@pm.me> | 2022-07-01 18:01:02 +0200 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-07-09 09:22:25 +0100 |
commit | df7b7cbfa43ba83808c2aa9e5034878f626454b1 (patch) | |
tree | 7e323aa93e9bca2e9c2018b21ca4a2506729f57b | |
parent | 8526c3f680e3e09c45e91e7fbccaed375d3f3412 (diff) | |
download | serenity-df7b7cbfa43ba83808c2aa9e5034878f626454b1.zip |
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.
-rw-r--r-- | Userland/Services/NetworkServer/main.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Services/NetworkServer/main.cpp b/Userland/Services/NetworkServer/main.cpp index a398b9794b..4bbf3fe232 100644 --- a/Userland/Services/NetworkServer/main.cpp +++ b/Userland/Services/NetworkServer/main.cpp @@ -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)); } |