summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorsjg <sjg@NetBSD.org>2010-04-20 17:18:08 +0000
committersjg <sjg@NetBSD.org>2010-04-20 17:18:08 +0000
commit197caaa8e0639309ecceb80cb2d2d48c23add3e4 (patch)
treeecf60563da78ab8674be8ceac798669fa20b020e /usr.bin/make
parentf08aebed018967f148f0823a33e00b4086379be7 (diff)
On some systems realpath will prefix make with cwd, so make sure
we can stat(2) the value for .MAKE
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 33f1a902758..dfa55397926 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.178 2010/04/14 16:16:17 sjg Exp $ */
+/* $NetBSD: main.c,v 1.179 2010/04/20 17:18:08 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.178 2010/04/14 16:16:17 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.179 2010/04/20 17:18:08 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.178 2010/04/14 16:16:17 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.179 2010/04/20 17:18:08 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -899,7 +899,7 @@ main(int argc, char **argv)
p1 = argv[0];
} else {
p1 = realpath(argv[0], mdpath);
- if (!p1 || *p1 != '/') {
+ if (!p1 || *p1 != '/' || stat(p1, &sb) < 0) {
p1 = argv[0]; /* realpath failed */
}
}