From 948435112e5c4eb4802c1dfba0732dd92fb9199e Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Wed, 13 Jun 2018 22:15:51 +0200 Subject: [PATCH] odhcpd: call handle_error when socket error can be retrieved Detected by Coverity in CID1412300 Signed-off-by: Hans Dedecker --- src/odhcpd.c | 4 ++-- 1 file 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); } -- 2.30.2