summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-03-21 23:58:17 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-03-23 09:49:01 +0100
commit895fdbb7d6b01e207103c8924c1c853f0fafee15 (patch)
tree82943772f9c5939df0785e1c8a1168019f90a5fa
parent451275470106024f106a310a5af050b3ca046a4f (diff)
flowtop: Print error cause if errno is set when panic
Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--flowtop.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/flowtop.c b/flowtop.c
index 33a110c..e7a1bfa 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -448,7 +448,7 @@ static void walk_processes(struct flow_entry *n)
dir = opendir("/proc");
if (!dir)
- panic("Cannot open /proc!\n");
+ panic("Cannot open /proc: %s\n", strerror(errno));
while ((ent = readdir(dir))) {
const char *name = ent->d_name;
@@ -1063,18 +1063,18 @@ static void *collector(void *null __maybe_unused)
NF_NETLINK_CONNTRACK_UPDATE |
NF_NETLINK_CONNTRACK_DESTROY);
if (!handle)
- panic("Cannot create a nfct handle!\n");
+ panic("Cannot create a nfct handle: %s\n", strerror(errno));
collector_flush(handle, AF_INET);
collector_flush(handle, AF_INET6);
filter = nfct_filter_create();
if (!filter)
- panic("Cannot create a nfct filter!\n");
+ panic("Cannot create a nfct filter: %s\n", strerror(errno));
ret = nfct_filter_attach(nfct_fd(handle), filter);
if (ret < 0)
- panic("Cannot attach filter to handle!\n");
+ panic("Cannot attach filter to handle: %s\n", strerror(errno));
if (what & INCLUDE_UDP) {
nfct_filter_add_attr_u32(filter, NFCT_FILTER_L4PROTO, IPPROTO_UDP);
@@ -1101,7 +1101,7 @@ static void *collector(void *null __maybe_unused)
ret = nfct_filter_attach(nfct_fd(handle), filter);
if (ret < 0)
- panic("Cannot attach filter to handle!\n");
+ panic("Cannot attach filter to handle: %s\n", strerror(errno));
nfct_callback_register(handle, NFCT_T_ALL, collector_cb, NULL);
nfct_filter_destroy(filter);