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): document possible undefined behavior i...



details:   https://anonhg.NetBSD.org/src/rev/2273d40b0539
branches:  trunk
changeset: 941867:2273d40b0539
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 31 22:05:56 2020 +0000

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

diffstat:

 usr.bin/make/trace.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r dc15fd6eb4c0 -r 2273d40b0539 usr.bin/make/trace.c
--- a/usr.bin/make/trace.c      Sat Oct 31 21:52:56 2020 +0000
+++ b/usr.bin/make/trace.c      Sat Oct 31 22:05:56 2020 +0000
@@ -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 @@
        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");



Home | Main Index | Thread Index | Old Index