Module Name: src
Committed By: rillig
Date: Wed May 10 16:10:02 UTC 2023
Modified Files:
src/usr.bin/make: parse.c
Log Message:
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:
~~~
To generate a diff of this commit:
cvs rdiff -u -r1.697 -r1.698 src/usr.bin/make/parse.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/parse.c
diff -u src/usr.bin/make/parse.c:1.697 src/usr.bin/make/parse.c:1.698
--- src/usr.bin/make/parse.c:1.697 Wed May 10 15:57:16 2023
+++ src/usr.bin/make/parse.c Wed May 10 16:10:02 2023
@@ -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);