summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorfjoe <fjoe@FreeBSD.org>2007-06-01 04:20:19 +0000
committerfjoe <fjoe@FreeBSD.org>2007-06-01 04:20:19 +0000
commita91466a709280533170342b8610ce73dde7de9ac (patch)
tree8fef33b0cca70d313b3552cbddcb82c5e653e180 /usr.bin
parent95d7fe260d2be5211d6bdae316b818a2863fd70e (diff)
downloadFreeBSD-src-a91466a709280533170342b8610ce73dde7de9ac.zip
FreeBSD-src-a91466a709280533170342b8610ce73dde7de9ac.tar.gz
Change directory back to ${.CURDIR} when remaking Makefiles.
Pointed out by: ru
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index e575ff2..fea2193 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -696,6 +696,10 @@ Remake_Makefiles(void)
int remade_cnt = 0;
Compat_InstallSignalHandlers();
+ if (curdir != objdir) {
+ if (chdir(curdir) < 0)
+ Fatal("Failed to change directory to %s.", curdir);
+ }
LST_FOREACH(ln, &source_makefiles) {
LstNode *ln2;
@@ -819,12 +823,16 @@ Remake_Makefiles(void)
setenv("MAKEFLAGS", save_makeflags, 1);
else
unsetenv("MAKEFLAGS");
- chdir(curdir);
if (execvp(save_argv[0], save_argv) < 0) {
Fatal("Can't restart `%s': %s.",
save_argv[0], strerror(errno));
}
}
+
+ if (curdir != objdir) {
+ if (chdir(objdir) < 0)
+ Fatal("Failed to change directory to %s.", objdir);
+ }
}
/**
OpenPOWER on IntegriCloud