Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Main_SetObjdir is first called for curdir which...
details: https://anonhg.NetBSD.org/src/rev/a6e2d5ddbac6
branches: trunk
changeset: 956511:a6e2d5ddbac6
user: sjg <sjg%NetBSD.org@localhost>
date: Sat Oct 31 21:09:22 2020 +0000
description:
Main_SetObjdir is first called for curdir which may be readonly
Skip access check if path is curdir.
This ensures that all proper initialization is done at least once.
If path is not curdir it should be writable to be useful.
Reviewed by: rillig
diffstat:
usr.bin/make/main.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (29 lines):
diff -r ce2d2c93e34c -r a6e2d5ddbac6 usr.bin/make/main.c
--- a/usr.bin/make/main.c Sat Oct 31 20:30:06 2020 +0000
+++ b/usr.bin/make/main.c Sat Oct 31 21:09:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.419 2020/10/31 16:13:00 rillig Exp $ */
+/* $NetBSD: main.c,v 1.420 2020/10/31 21:09:22 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.419 2020/10/31 16:13:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.420 2020/10/31 21:09:22 sjg Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -721,7 +721,9 @@
/* look for the directory and try to chdir there */
if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {
- if (chdir(path)) {
+ /* if not .CURDIR it must be writable */
+ if ((strcmp(path, curdir) != 0 && access(path, W_OK) != 0) ||
+ chdir(path)) {
(void)fprintf(stderr, "make warning: %s: %s.\n",
path, strerror(errno));
} else {
Home |
Main Index |
Thread Index |
Old Index