You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
From 094f7dd2dce0c449313f1f1ea69dc849fc89b62a Mon Sep 17 00:00:00 2001 |
|
From: Phil Sutter <psutter@redhat.com> |
|
Date: Wed, 20 Jun 2018 09:22:47 +0200 |
|
Subject: [PATCH] netlink: Complain if setting O_NONBLOCK fails |
|
|
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1504157 |
|
Upstream Status: nftables commit 4342fcbd40534 |
|
|
|
commit 4342fcbd40534158107ebe6a10e5f7886b3e8ced |
|
Author: Phil Sutter <phil@nwl.cc> |
|
Date: Thu Mar 1 15:00:31 2018 +0100 |
|
|
|
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> |
|
--- |
|
src/netlink.c | 3 ++- |
|
1 file changed, 2 insertions(+), 1 deletion(-) |
|
|
|
diff --git a/src/netlink.c b/src/netlink.c |
|
index ca0e207..ebfad18 100644 |
|
--- a/src/netlink.c |
|
+++ b/src/netlink.c |
|
@@ -58,7 +58,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; |
|
} |
|
-- |
|
1.8.3.1 |
|
|
|
|