summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-06-13 22:15:51 +0200
committerHans Dedecker <dedeckeh@gmail.com>2018-06-13 22:16:52 +0200
commit948435112e5c4eb4802c1dfba0732dd92fb9199e (patch)
treee52b95ec3f81756267a062370475c0d16ab8fe33
parentc45e2eb865cffd3d2556efc39de02c9b0c56b79b (diff)
odhcpd: call handle_error when socket error can be retrieved
Detected by Coverity in CID1412300 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--src/odhcpd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/odhcpd.c b/src/odhcpd.c
index 7c6c144..9ab849a 100644
--- a/src/odhcpd.c
+++ b/src/odhcpd.c
@@ -320,9 +320,9 @@ static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even
if (u->error) {
int ret = -1;
socklen_t ret_len = sizeof(ret);
- getsockopt(u->fd, SOL_SOCKET, SO_ERROR, &ret, &ret_len);
+
u->error = false;
- if (e->handle_error)
+ if (e->handle_error && getsockopt(u->fd, SOL_SOCKET, SO_ERROR, &ret, &ret_len) == 0)
e->handle_error(e, ret);
}