Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: flush stdout before an internal error



details:   https://anonhg.NetBSD.org/src/rev/6a7db376e5d3
branches:  trunk
changeset: 1022236:6a7db376e5d3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 10 12:17:31 2021 +0000

description:
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.

diffstat:

 usr.bin/xlint/lint1/err.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 7e460247df48 -r 6a7db376e5d3 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sat Jul 10 12:10:39 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sat Jul 10 12:17:31 2021 +0000
@@ -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 @@
        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 @@
        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);



Home | Main Index | Thread Index | Old Index