mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
DHCPClient: Close outgoing sockets after use
This commit is contained in:
parent
ede818cbf9
commit
1bdaee475b
1 changed files with 3 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonParser.h>
|
||||
#include <AK/Random.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/Try.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Timer.h>
|
||||
|
@ -40,6 +41,8 @@ static bool send(InterfaceDescriptor const& iface, DHCPv4Packet const& packet, C
|
|||
return false;
|
||||
}
|
||||
|
||||
ScopeGuard socket_close_guard = [&] { close(fd); };
|
||||
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface.ifname.characters(), IFNAMSIZ) < 0) {
|
||||
dbgln("ERROR: setsockopt(SO_BINDTODEVICE) :: {}", strerror(errno));
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue