From: Hans Dedecker Date: Fri, 22 Jun 2018 14:32:31 +0000 (+0200) Subject: dhcpv6-ia: improve error checking in assign_pd() X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5b087a66b0d85f828d56f8ccd745d14da78544bc;p=oweals%2Fodhcpd.git dhcpv6-ia: improve error checking in assign_pd() Detected by Coverity in CID1412267 Signed-off-by: Hans Dedecker --- diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 1c94a65..8eada74 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -581,7 +581,9 @@ static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign) if (iface->dhcpv6_pd_manager[0]) { int fd = usock(USOCK_UNIX | USOCK_TCP, iface->dhcpv6_pd_manager, NULL); if (fd >= 0) { + struct pollfd pfd = { .fd = fd, .events = POLLIN }; char iaidbuf[298]; + odhcpd_hexlify(iaidbuf, assign->clid_data, assign->clid_len); assign->managed_sock.stream.notify_read = managed_handle_pd_data; @@ -598,8 +600,11 @@ static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign) list_add(&assign->head, &iface->ia_assignments); /* Wait initial period of up to 250ms for immediate assignment */ - struct pollfd pfd = { .fd = fd, .events = POLLIN }; - poll(&pfd, 1, 250); + if (poll(&pfd, 1, 250) < 0) { + syslog(LOG_ERR, "poll(): %m"); + return false; + } + managed_handle_pd_data(&assign->managed_sock.stream, 0); if (fcntl(fd, F_GETFL) >= 0 && assign->managed_size > 0)