--- src/netlink.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/netlink.c b/src/netlink.c index 533634a..664487d 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -33,8 +33,11 @@ static struct mnl_socket *nf_sock; static void __init netlink_open_sock(void) { nf_sock = mnl_socket_open(NETLINK_NETFILTER); - if (nf_sock == NULL) + if (nf_sock == NULL) { + fprintf(fdopen(STDERR_FILENO, "a"), "Could not open AF_NETLINK socket: %s\n", + strerror(errno)); memory_allocation_error(); + } fcntl(mnl_socket_get_fd(nf_sock), F_SETFL, O_NONBLOCK); mnl_batch_init(); @@ -42,7 +45,8 @@ static void __init netlink_open_sock(void) static void __exit netlink_close_sock(void) { - mnl_socket_close(nf_sock); + if (nf_sock) + mnl_socket_close(nf_sock); } int netlink_io_error(struct netlink_ctx *ctx, const struct location *loc, -- 1.8.5.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