Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): use stderr for error message about fai...



details:   https://anonhg.NetBSD.org/src/rev/cfbb98fa17d8
branches:  trunk
changeset: 957018:cfbb98fa17d8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 14 15:47:35 2020 +0000

description:
make(1): use stderr for error message about failed touch

Error messages belong on stderr, not stdout.  Since at least 1993,
stdout had been used for no good reason.  Plus, in all these years,
nobody ever tested this code path since otherwise the missing newline at
the end of the error message would have been obvious.

This is a good candidate for the "oldest bug in make" trophy.

diffstat:

 usr.bin/make/job.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r a2817e4eea1b -r cfbb98fa17d8 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sat Nov 14 15:35:20 2020 +0000
+++ b/usr.bin/make/job.c        Sat Nov 14 15:47:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.321 2020/11/14 14:16:01 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.322 2020/11/14 15:47:35 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.321 2020/11/14 14:16:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.322 2020/11/14 15:47:35 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1107,9 +1107,9 @@
 
     fd = open(file, O_RDWR | O_CREAT, 0666);
     if (fd < 0) {
-       (void)fprintf(stdout, "*** couldn't touch %s: %s",
+       (void)fprintf(stderr, "*** couldn't touch %s: %s\n",
                      file, strerror(errno));
-       (void)fflush(stdout);
+       (void)fflush(stderr);
        return;                /* XXX: What about propagating the error? */
     }
 



Home | Main Index | Thread Index | Old Index