summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--die.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/die.h b/die.h
index 4a3f09b..919f3ae 100644
--- a/die.h
+++ b/die.h
@@ -1,15 +1,10 @@
-/*
- * netsniff-ng - the packet sniffing beast
- * Copyright 2009, 2010 Daniel Borkmann.
- * Subject to the GPL, version 2.
- */
-
#ifndef DIE_H
#define DIE_H
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
@@ -20,19 +15,29 @@
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);
-static inline void syslog_maybe(int may, int priority,
+static inline void syslog_maybe(bool cond, int priority,
const char *format, ...) __check_format_printf(3, 4);
-static inline void __noreturn die(void)
+static inline void __noreturn __die_hard(void)
{
exit(EXIT_FAILURE);
}
-static inline void __noreturn _die(void)
+static inline void __noreturn __die_harder(void)
{
_exit(EXIT_FAILURE);
}
+static inline void __noreturn die(void)
+{
+ __die_hard();
+}
+
+static inline void __noreturn _die(void)
+{
+ __die_harder();
+}
+
static inline void __noreturn panic(const char *format, ...)
{
va_list vl;
@@ -55,9 +60,10 @@ static inline void __noreturn syslog_panic(const char *format, ...)
die();
}
-static inline void syslog_maybe(int maybe, int priority, const char *format, ...)
+static inline void syslog_maybe(bool cond, int priority,
+ const char *format, ...)
{
- if (!!maybe) {
+ if (cond) {
va_list vl;
va_start(vl, format);