aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-01-25 12:36:01 +0100
committerlemon <lsof@mailbox.org>2026-01-25 12:36:01 +0100
commitca983b5700f894c653758a4f93a758b93d025621 (patch)
treec1791a7f324f93efb63297bf7686d9bb42f2c91e /io.c
parenta017cf8b32f6726d5619361fa9d5e88f850dc1cb (diff)
c: GNU __attribute__ stubs
Diffstat (limited to 'io.c')
-rw-r--r--io.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/io.c b/io.c
index 9e7cba7..d98eacd 100644
--- a/io.c
+++ b/io.c
@@ -1100,12 +1100,13 @@ vdiag(const struct span *span, enum diagkind kind, const char *fmt, va_list ap)
void _Noreturn
fatal(const struct span *span, const char *fmt, ...)
{
- va_list ap;
-
- va_start(ap, fmt);
- vdiag(span, DGERROR, fmt, ap);
- va_end(ap);
- if (span) efmt("Aborting due to previous error.\n");
+ if (fmt) {
+ va_list ap;
+ va_start(ap, fmt);
+ vdiag(span, DGERROR, fmt, ap);
+ va_end(ap);
+ }
+ if (!fmt || span) efmt("Aborting due to previous error.\n");
exit(1);
}