summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-05-10 16:10:02 +0000
committerrillig <rillig@NetBSD.org>2023-05-10 16:10:02 +0000
commitc6e49c503ffdd5748eec855f6b10ad58aba5cf09 (patch)
tree2236b50b6a191bbb4d28b22712c9fb6fc9b42344 /usr.bin/make
parentc604550a26e99234972e68f312d4928f1274ab4f (diff)
make: don't print null filename in stack traces
~~~makefile != printf '%s\n' '.include "2.mk"' > 1.mk != printf '%s\n' '!= rm 1.mk' '.info message' > 2.mk .MAKEFLAGS: -dp .include "1.mk" .MAKEFLAGS: -d0 all: ~~~
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/parse.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index d2b03928e3e..955ad333706 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.697 2023/05/10 15:57:16 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.698 2023/05/10 16:10:02 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.697 2023/05/10 15:57:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.698 2023/05/10 16:10:02 rillig Exp $");
/*
* A file being read.
@@ -384,8 +384,11 @@ PrintStackTrace(bool includingInnermost)
const char *fname = entry->name.str;
char dirbuf[MAXPATHLEN + 1];
- if (fname[0] != '/' && strcmp(fname, "(stdin)") != 0)
- fname = realpath(fname, dirbuf);
+ if (fname[0] != '/' && strcmp(fname, "(stdin)") != 0) {
+ const char *realPath = realpath(fname, dirbuf);
+ if (realPath != NULL)
+ fname = realPath;
+ }
if (entry->forLoop != NULL) {
char *details = ForLoop_Details(entry->forLoop);