diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2019-04-04 12:01:46 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2019-04-04 15:36:15 +0200 |
commit | e7b1d4bf3a2297192638b9c84208b3dcb306ecd8 (patch) | |
tree | a371584b78e0a0c1dd8b6e4339393aa9b2a20652 /src/dhcpv4.c | |
parent | 7798d502f4c2e89a2493c0ea7a800a9359ee0bbc (diff) |
treewide: initialize properly file descriptors
Initialzie properly the dhcpv6, dhcpv4 and ndp ffile descriptors
when creating an interface.
As such the check for a valid descriptor can be done correct now
in the different modules
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv4.c')
-rw-r--r-- | src/dhcpv4.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 5016390..88719e0 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -73,7 +73,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable) { int ret = 0; - if (iface->dhcpv4_event.uloop.fd > 0) { + if (iface->dhcpv4_event.uloop.fd >= 0) { uloop_fd_delete(&iface->dhcpv4_event.uloop); close(iface->dhcpv4_event.uloop.fd); iface->dhcpv4_event.uloop.fd = -1; @@ -163,7 +163,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable) } out: - if (ret < 0 && iface->dhcpv4_event.uloop.fd > 0) { + if (ret < 0 && iface->dhcpv4_event.uloop.fd >= 0) { close(iface->dhcpv4_event.uloop.fd); iface->dhcpv4_event.uloop.fd = -1; } |