aboutsummaryrefslogtreecommitdiffstats
path: root/man7
diff options
context:
space:
mode:
Diffstat (limited to 'man7')
-rw-r--r--man7/sock_diag.79
1 files changed, 6 insertions, 3 deletions
diff --git a/man7/sock_diag.7 b/man7/sock_diag.7
index 8b4ed340bf..97cab46327 100644
--- a/man7/sock_diag.7
+++ b/man7/sock_diag.7
@@ -753,9 +753,7 @@ static int
receive_responses(int fd)
{
long buf[8192 / sizeof(long)];
- struct sockaddr_nl nladdr = {
- .nl_family = AF_NETLINK
- };
+ struct sockaddr_nl nladdr;
struct iovec iov = {
.iov_base = buf,
.iov_len = sizeof(buf)
@@ -782,6 +780,11 @@ receive_responses(int fd)
if (ret == 0)
return 0;
+ if (nladdr.nl_family != AF_NETLINK) {
+ fputs("!AF_NETLINK\en", stderr);
+ return \-1;
+ }
+
const struct nlmsghdr *h = (struct nlmsghdr *) buf;
if (!NLMSG_OK(h, ret)) {