From b4a3c0bec3fd3b178d6c5694cd8b6bff22a2e1c3 Mon Sep 17 00:00:00 2001 From: sjg Date: Thu, 29 Apr 2010 23:12:21 +0000 Subject: [PATCH] fflush stdout, before writing to stderr. --- usr.bin/make/main.c | 9 ++++++--- usr.bin/make/parse.c | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 8a8c4d311e4e..f68c99535ac8 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.183 2010/04/23 00:18:50 sjg Exp $ */ +/* $NetBSD: main.c,v 1.184 2010/04/29 23:12:21 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.183 2010/04/23 00:18:50 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.184 2010/04/29 23:12:21 sjg Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.183 2010/04/23 00:18:50 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.184 2010/04/29 23:12:21 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -1695,6 +1695,7 @@ Error(const char *fmt, ...) err_file = debug_file; if (err_file == stdout) err_file = stderr; + (void)fflush(stdout); for (;;) { va_start(ap, fmt); fprintf(err_file, "%s: ", progname); @@ -1729,6 +1730,7 @@ Fatal(const char *fmt, ...) if (jobsRunning) Job_Wait(); + (void)fflush(stdout); (void)vfprintf(stderr, fmt, ap); va_end(ap); (void)fprintf(stderr, "\n"); @@ -1760,6 +1762,7 @@ Punt(const char *fmt, ...) va_list ap; va_start(ap, fmt); + (void)fflush(stdout); (void)fprintf(stderr, "%s: ", progname); (void)vfprintf(stderr, fmt, ap); va_end(ap); diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 15e93ab950b9..2f35d364b3f8 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.162 2010/04/08 17:41:29 sjg Exp $ */ +/* $NetBSD: parse.c,v 1.163 2010/04/29 23:12:21 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: parse.c,v 1.162 2010/04/08 17:41:29 sjg Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.163 2010/04/29 23:12:21 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: parse.c,v 1.162 2010/04/08 17:41:29 sjg Exp $"); +__RCSID("$NetBSD: parse.c,v 1.163 2010/04/29 23:12:21 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -451,6 +451,7 @@ ParseErrorInternal(const char *cfname, size_t clineno, int type, va_list ap; va_start(ap, fmt); + (void)fflush(stdout); ParseVErrorInternal(stderr, cfname, clineno, type, fmt, ap); va_end(ap); @@ -489,6 +490,7 @@ Parse_Error(int type, const char *fmt, ...) } va_start(ap, fmt); + (void)fflush(stdout); ParseVErrorInternal(stderr, fname, lineno, type, fmt, ap); va_end(ap); @@ -2712,6 +2714,7 @@ Parse_File(const char *name, int fd) } while (ParseEOF() == CONTINUE); if (fatals) { + (void)fflush(stdout); (void)fprintf(stderr, "%s: Fatal errors encountered -- cannot continue\n", progname);