Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make When we change .OBJDIR we should delete any cac...
details: https://anonhg.NetBSD.org/src/rev/083cc53b50af
branches: trunk
changeset: 352339:083cc53b50af
user: sjg <sjg%NetBSD.org@localhost>
date: Sun Mar 26 17:16:03 2017 +0000
description:
When we change .OBJDIR we should delete any cached realpath results
for relative paths.
Reviewed by: christos
diffstat:
usr.bin/make/main.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diffs (59 lines):
diff -r 0dfcdbbcd0f1 -r 083cc53b50af usr.bin/make/main.c
--- a/usr.bin/make/main.c Sun Mar 26 16:53:36 2017 +0000
+++ b/usr.bin/make/main.c Sun Mar 26 17:16:03 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg Exp $ */
+/* $NetBSD: main.c,v 1.259 2017/03/26 17:16:03 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.259 2017/03/26 17:16:03 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.259 2017/03/26 17:16:03 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -722,6 +722,7 @@
Var_Set(".OBJDIR", objdir, VAR_GLOBAL, 0);
setenv("PWD", objdir, 1);
Dir_InitDot();
+ cached_realpath(".OBJDIR", NULL); /* purge */
rc = TRUE;
if (enterFlag && strcmp(objdir, curdir) != 0)
enterFlagObj = TRUE;
@@ -1889,7 +1890,23 @@
cache->flags = INTERNAL;
#endif
}
+ if (resolved == NULL && strcmp(pathname, ".OBJDIR") == 0) {
+ /* purge any relative paths */
+ Hash_Entry *he, *nhe;
+ Hash_Search hs;
+ he = Hash_EnumFirst(&cache->context, &hs);
+ while (he) {
+ nhe = Hash_EnumNext(&hs);
+ if (he->name[0] != '/') {
+ if (DEBUG(DIR))
+ fprintf(stderr, "cached_realpath: purging %s\n", he->name);
+ Hash_DeleteEntry(&cache->context, he);
+ }
+ he = nhe;
+ }
+ return NULL;
+ }
if ((rp = Var_Value(pathname, cache, &cp)) != NULL) {
/* a hit */
strncpy(resolved, rp, MAXPATHLEN);
Home |
Main Index |
Thread Index |
Old Index