Change directory back to ${.CURDIR} when remaking Makefiles.

Pointed out by:	ru
This commit is contained in:
Max Khon 2007-06-01 04:20:19 +00:00
parent 8ef6b1429f
commit 6d000893b4

View File

@ -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);
}
}
/**