summaryrefslogtreecommitdiff
path: root/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace.c')
-rw-r--r--trace.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/trace.c b/trace.c
index 0611318dbf076..a129406f2f3f7 100644
--- a/trace.c
+++ b/trace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: trace.c,v 1.15 2020/08/03 20:26:09 rillig Exp $ */
+/* $NetBSD: trace.c,v 1.21 2020/10/31 22:05:56 rillig Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -29,16 +29,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: trace.c,v 1.15 2020/08/03 20:26:09 rillig Exp $";
-#else
-#include <sys/cdefs.h>
-#ifndef lint
-__RCSID("$NetBSD: trace.c,v 1.15 2020/08/03 20:26:09 rillig Exp $");
-#endif /* not lint */
-#endif
-
/*-
* trace.c --
* handle logging of trace events generated by various parts of make.
@@ -54,13 +44,12 @@ __RCSID("$NetBSD: trace.c,v 1.15 2020/08/03 20:26:09 rillig Exp $");
#include <sys/time.h>
-#include <stdio.h>
-#include <unistd.h>
-
#include "make.h"
#include "job.h"
#include "trace.h"
+MAKE_RCSID("$NetBSD: trace.c,v 1.21 2020/10/31 22:05:56 rillig Exp $");
+
static FILE *trfile;
static pid_t trpid;
const char *trwd;
@@ -78,8 +67,10 @@ void
Trace_Init(const char *pathname)
{
if (pathname != NULL) {
- char *dontFreeIt;
+ 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");