diff options
Diffstat (limited to 'c_src/tools-util.h')
-rw-r--r-- | c_src/tools-util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/c_src/tools-util.h b/c_src/tools-util.h index ca84dd01..d3d6b14b 100644 --- a/c_src/tools-util.h +++ b/c_src/tools-util.h @@ -82,6 +82,12 @@ static inline void *xrealloc(void *p, size_t size) _ret; \ }) +#define xclose(_fd) \ +do { \ + if (close(_fd)) \ + die("error closing fd: %m at %s:%u", __FILE__, __LINE__);\ +} while (0) + void write_file_str(int, const char *, const char *); char *read_file_str(int, const char *); u64 read_file_u64(int, const char *); |