[nft PATCH 5/6] netlink: Complain if setting O_NONBLOCK fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 src/netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/netlink.c b/src/netlink.c
index c7adf8b409c69..06b1f57ae1948 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;
 }
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux