diff options
Diffstat (limited to 'common/err.h')
-rw-r--r-- | common/err.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/common/err.h b/common/err.h index 1dccbf9..b9faf11 100644 --- a/common/err.h +++ b/common/err.h @@ -1,5 +1,5 @@ -#ifndef _ERR_H_ -#define _ERR_H_ +#ifndef _COMMON_ERR_H_ +#define _COMMON_ERR_H_ #include <stdio.h> #include <stdlib.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 |