aboutsummaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-04-13 21:23:34 +0200
committerToni Uhlig <matzeton@googlemail.com>2018-04-13 21:23:34 +0200
commitecf35293f80bba8b83a0dbf28f097812aa4353cb (patch)
tree51f8dea80d0fda06e85b2f910f76a9ea872d2fa5 /src/log.h
parent0e9015400269e004d8dbe006d47fa9e4556603ec (diff)
POTD skeleton #3.
Diffstat (limited to 'src/log.h')
-rw-r--r--src/log.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/log.h b/src/log.h
index 02f56df..cfc4471 100644
--- a/src/log.h
+++ b/src/log.h
@@ -24,9 +24,13 @@
#define E_STRERR(msg) { if (errno) E2("%s failed: %s", msg, strerror(errno)); }
#define E_GAIERR(ret, msg) { if (ret) { E2("%s failed: %s", msg, gai_strerror(ret)); } }
#define ABORT_ON_FATAL(expr, msg) \
- { errno = 0; if (expr) { E_STRERR(msg); abort(); } }
+ { errno = 0; long rv = (long) expr; \
+ if (rv) { E2("`%s` returned: %ld", #expr, rv); \
+ E_STRERR(msg); abort(); } }
#define GAI_ABORT_ON_FATAL(expr, msg) \
- { int rv = expr; if (rv) { E_GAIERR(rv, msg); abort(); } }
+ { int rv = expr; \
+ if (rv) { E2("`%s` returned: %d", #expr, rv); \
+ E_GAIERR(rv, msg); abort(); } }
typedef enum log_priority {
DEBUG = 0, NOTICE, WARNING, ERROR