Module Name: src
Committed By: rillig
Date: Sat Jul 10 12:17:31 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: err.c
Log Message:
lint: flush stdout before an internal error
Previously, the internal error may have appeared too early in the
output. Provoking internal errors and assertion failures is still easy,
just run afl-fuzz for a few seconds.
To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/xlint/lint1/err.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.126 src/usr.bin/xlint/lint1/err.c:1.127
--- src/usr.bin/xlint/lint1/err.c:1.126 Mon Jul 5 19:53:43 2021
+++ src/usr.bin/xlint/lint1/err.c Sat Jul 10 12:17:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.126 2021/07/05 19:53:43 rillig Exp $ */
+/* $NetBSD: err.c,v 1.127 2021/07/10 12:17:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.126 2021/07/05 19:53:43 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.127 2021/07/10 12:17:31 rillig Exp $");
#endif
#include <sys/types.h>
@@ -569,6 +569,7 @@ internal_error(const char *file, int lin
const char *fn;
fn = lbasename(curr_pos.p_file);
+ fflush(stdout);
(void)fprintf(stderr, "lint: internal error in %s:%d near %s:%d: ",
file, line, fn, curr_pos.p_line);
va_start(ap, msg);
@@ -585,6 +586,7 @@ assert_failed(const char *file, int line
const char *fn;
fn = lbasename(curr_pos.p_file);
+ fflush(stdout);
(void)fprintf(stderr,
"lint: assertion \"%s\" failed in %s at %s:%d near %s:%d\n",
cond, func, file, line, fn, curr_pos.p_line);