aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/log.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/log.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/log.h b/src/log.h
index 33e3040..87f352f 100644
--- a/src/log.h
+++ b/src/log.h
@@ -15,6 +15,13 @@
perror(s); \
} while (0)
+#define check_errno(expr, s) \
+ do { \
+ int CONCAT(ret, __LINE__) = expr; \
+ if (CONCAT(ret, __LINE__) < 0) \
+ print_errno(s); \
+ } while (0)
+
#define pthread_print_errno(var, s) \
do { \
errno = var; \