From dd3da75c8d9da1f589ac6dded6140a4dc8d4b93f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 30 Dec 2021 21:53:01 +0100 Subject: Unify error messages and checking --- common/err.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common/err.h') diff --git a/common/err.h b/common/err.h index 34620bb..b9faf11 100644 --- a/common/err.h +++ b/common/err.h @@ -14,4 +14,14 @@ static inline void error(const char *format, ...) exit(1); } +static inline void syserror(const char *call, FILE *file) +{ + perror(call); + + if (file) + fclose(file); + + exit(1); +} + #endif -- cgit v1.2.3