summaryrefslogtreecommitdiff
path: root/die.h
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-04-20 12:43:08 +0300
committerTobias Klauser <tklauser@distanz.ch>2015-04-21 16:44:15 +0200
commitdce80974dcd2114ebb4a3ed3060d4d636cbb9d1d (patch)
tree9fc6c6bf864695f06b98dbb3ef4c18d1105604b2 /die.h
parent9278bb65e810156ed1074e693fce14e7ecf145e8 (diff)
netsniff-ng: Delete rfmon mac80211 device in case of panic
netsniff-ng does not delete created rfmon device in case of panic (for example - bad pcap filter expression), so added ability to add callback func when panic will be happen and delete rfmon device. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'die.h')
-rw-r--r--die.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/die.h b/die.h
index 919f3ae..0d709d0 100644
--- a/die.h
+++ b/die.h
@@ -12,6 +12,9 @@
#include "built_in.h"
+extern void panic_func_add(void (*on_panic)(void *arg), void *arg);
+extern void call_on_panic_funcs(void);
+
static inline void panic(const char *format, ...) __check_format_printf(1, 2);
static inline void syslog_panic(const char *format,
...) __check_format_printf(1, 2);
@@ -20,11 +23,13 @@ static inline void syslog_maybe(bool cond, int priority,
static inline void __noreturn __die_hard(void)
{
+ call_on_panic_funcs();
exit(EXIT_FAILURE);
}
static inline void __noreturn __die_harder(void)
{
+ call_on_panic_funcs();
_exit(EXIT_FAILURE);
}