summaryrefslogtreecommitdiffstats
path: root/nhrpd/linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'nhrpd/linux.c')
-rw-r--r--nhrpd/linux.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nhrpd/linux.c b/nhrpd/linux.c
index bcf97f030..f697311d4 100644
--- a/nhrpd/linux.c
+++ b/nhrpd/linux.c
@@ -60,7 +60,7 @@ int os_sendmsg(const uint8_t *buf, size_t len, int ifindex, const uint8_t *addr,
.msg_iov = &iov,
.msg_iovlen = 1,
};
- int status;
+ int status, fd;
if (addrlen > sizeof(lladdr.sll_addr))
return -1;
@@ -72,7 +72,11 @@ int os_sendmsg(const uint8_t *buf, size_t len, int ifindex, const uint8_t *addr,
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;