Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make We need to have set curdir before calling Dir_F...
details: https://anonhg.NetBSD.org/src/rev/cb15760d7226
branches: trunk
changeset: 750526:cb15760d7226
user: sjg <sjg%NetBSD.org@localhost>
date: Mon Jan 04 17:05:25 2010 +0000
description:
We need to have set curdir before calling Dir_FindHereOrAbove().
We can call getcwd again if -C is used.
diffstat:
usr.bin/make/main.c | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diffs (81 lines):
diff -r 4c0cec89a0f6 -r cb15760d7226 usr.bin/make/main.c
--- a/usr.bin/make/main.c Mon Jan 04 16:57:48 2010 +0000
+++ b/usr.bin/make/main.c Mon Jan 04 17:05:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.174 2009/09/09 17:09:49 sjg Exp $ */
+/* $NetBSD: main.c,v 1.175 2010/01/04 17:05:25 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.174 2009/09/09 17:09:49 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.175 2010/01/04 17:05:25 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.174 2009/09/09 17:09:49 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.175 2010/01/04 17:05:25 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -393,6 +393,10 @@
strerror(errno));
exit(1);
}
+ if (getcwd(curdir, MAXPATHLEN) == NULL) {
+ (void)fprintf(stderr, "%s: %s.\n", progname, strerror(errno));
+ exit(2);
+ }
ignorePWD = TRUE;
break;
case 'D':
@@ -509,7 +513,6 @@
found_path, sizeof(found_path)))
break; /* nothing doing */
(void)Dir_AddDir(sysIncPath, found_path);
-
} else {
(void)Dir_AddDir(sysIncPath, argvalue);
}
@@ -881,18 +884,20 @@
Main_ParseArgLine(getenv("MAKE"));
#endif
- MainParseArgs(argc, argv);
-
/*
- * Find where we are (now) and take care of PWD for the automounter...
- * All this code is so that we know where we are when we start up
- * on a different machine with pmake.
+ * Find where we are (now).
+ * We take care of PWD for the automounter below...
*/
if (getcwd(curdir, MAXPATHLEN) == NULL) {
(void)fprintf(stderr, "%s: %s.\n", progname, strerror(errno));
exit(2);
}
+ MainParseArgs(argc, argv);
+
+ /*
+ * Verify that cwd is sane.
+ */
if (stat(curdir, &sa) == -1) {
(void)fprintf(stderr, "%s: %s: %s.\n",
progname, curdir, strerror(errno));
@@ -900,6 +905,8 @@
}
/*
+ * All this code is so that we know where we are when we start up
+ * on a different machine with pmake.
* Overriding getcwd() with $PWD totally breaks MAKEOBJDIRPREFIX
* since the value of curdir can vary depending on how we got
* here. Ie sitting at a shell prompt (shell that provides $PWD)
Home |
Main Index |
Thread Index |
Old Index