Module Name:    src
Committed By:   rillig
Date:           Sat Nov 14 15:47:36 UTC 2020

Modified Files:
        src/usr.bin/make: job.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.321 -r1.322 src/usr.bin/make/job.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/make/job.c
diff -u src/usr.bin/make/job.c:1.321 src/usr.bin/make/job.c:1.322
--- src/usr.bin/make/job.c:1.321	Sat Nov 14 14:16:01 2020
+++ src/usr.bin/make/job.c	Sat Nov 14 15:47:35 2020
@@ -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 @@ TouchRegular(GNode *gn)
 
     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? */
     }
 

Reply via email to