summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2015-04-06 13:57:10 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2015-04-09 13:50:00 +0200
commit628122466c32e7f1795c9754a46e6b6b91e71aa5 (patch)
treef49a50b27db294fd800fb5db1868474f275c2e8c /src
parentcd861145b95a1d0fc9b716e806fed8935df56adc (diff)
src: introduce netlink_init_error()
Based on the existing netlink_open_error(), but indicate file and line where the error happens. This will help us to diagnose what is going wrong when users can back to us to report problems. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/netlink.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/netlink.c b/src/netlink.c
index c118502a..343d8bea 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -52,7 +52,7 @@ static struct mnl_socket *nfsock_open(void)
s = mnl_socket_open(NETLINK_NETFILTER);
if (s == NULL)
- netlink_open_error();
+ netlink_init_error();
return s;
}
@@ -110,10 +110,11 @@ int netlink_io_error(struct netlink_ctx *ctx, const struct location *loc,
return -1;
}
-void __noreturn netlink_open_error(void)
+void __noreturn __netlink_init_error(const char *filename, int line,
+ const char *reason)
{
- fprintf(stderr, "E: Unable to open Netlink socket: %s\n",
- strerror(errno));
+ fprintf(stderr, "%s:%d: Unable to initialize Netlink socket: %s\n",
+ filename, line, reason);
exit(NFT_EXIT_NONL);
}