Ensure we don't try to use an invalid fd in nhrpd, reported
by coverity.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
.msg_iov = &iov,
.msg_iovlen = 1,
};
- int status;
+ int status, fd;
if (addrlen > sizeof(lladdr.sll_addr))
return -1;
lladdr.sll_halen = addrlen;
memcpy(lladdr.sll_addr, addr, addrlen);
- status = sendmsg(os_socket(), &msg, 0);
+ fd = os_socket();
+ if (fd < 0)
+ return -1;
+
+ status = sendmsg(fd, &msg, 0);
if (status < 0)
return -errno;