summaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/common.h b/src/common.h
index 7a9c555..a45b6f4 100644
--- a/src/common.h
+++ b/src/common.h
@@ -26,16 +26,18 @@ store32_le(uint8_t dst[4], uint32_t w)
}
static void
-die(const char *msg)
+die(int print_errno, const char *format, ...)
{
- fprintf(stderr, "%s\n", msg);
- exit(1);
-}
+ va_list ap;
+
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (print_errno) {
+ fprintf(stderr, "- %s", strerror(errno));
+ }
+ fprintf(stderr, "\n");
-static void
-diex(const char *msg)
-{
- perror(msg);
exit(1);
}