summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-03-01 15:00:31 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-03-02 11:46:56 +0100
commit4342fcbd40534158107ebe6a10e5f7886b3e8ced (patch)
tree432b5c894fe67f720e61d3e14edfca3447a4b172 /src
parent5043a1e4847c0149dabaf0b529a14a43b957e5e4 (diff)
netlink: Complain if setting O_NONBLOCK fails
Assuming that code is not aware that reads from netlink socket may block, treat inability to set O_NONBLOCK flag as fatal initialization error aborting program execution. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/netlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/netlink.c b/src/netlink.c
index c7adf8b4..06b1f57a 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -59,7 +59,8 @@ struct mnl_socket *netlink_open_sock(void)
if (nf_sock == NULL)
netlink_init_error();
- fcntl(mnl_socket_get_fd(nf_sock), F_SETFL, O_NONBLOCK);
+ if (fcntl(mnl_socket_get_fd(nf_sock), F_SETFL, O_NONBLOCK))
+ netlink_init_error();
return nf_sock;
}