Module Name:    src
Committed By:   rillig
Date:           Sat Oct 31 22:05:56 UTC 2020

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

Log Message:
make(1): document possible undefined behavior in trace.c with .CURDIR


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/trace.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/trace.c
diff -u src/usr.bin/make/trace.c:1.20 src/usr.bin/make/trace.c:1.21
--- src/usr.bin/make/trace.c:1.20	Fri Oct 30 20:30:44 2020
+++ src/usr.bin/make/trace.c	Sat Oct 31 22:05:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trace.c,v 1.20 2020/10/30 20:30:44 rillig Exp $	*/
+/*	$NetBSD: trace.c,v 1.21 2020/10/31 22:05:56 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
 #include "job.h"
 #include "trace.h"
 
-MAKE_RCSID("$NetBSD: trace.c,v 1.20 2020/10/30 20:30:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: trace.c,v 1.21 2020/10/31 22:05:56 rillig Exp $");
 
 static FILE *trfile;
 static pid_t trpid;
@@ -69,6 +69,8 @@ Trace_Init(const char *pathname)
 	if (pathname != NULL) {
 		void *dontFreeIt;
 		trpid = getpid();
+		/* XXX: This variable may get overwritten later, which
+		 * would make trwd point to undefined behavior. */
 		trwd = Var_Value(".CURDIR", VAR_GLOBAL, &dontFreeIt);
 
 		trfile = fopen(pathname, "a");

Reply via email to