diff options
author | Paul Smith <psmith@gnu.org> | 2013-09-18 19:29:28 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2013-09-18 19:29:28 -0400 |
commit | 39c197db5191dd9e5e3b1a73e56a0bc5d2923e8d (patch) | |
tree | 7b9d400e49cb245887fcfd6ce45c6bad32e665a6 /main.c | |
parent | 45bebee5ef80161f509e3a38ced7351574a22714 (diff) | |
download | make-39c197db5191dd9e5e3b1a73e56a0bc5d2923e8d.tar.gz |
[SV 40043] Set the current directory before printing errors.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1477,6 +1477,9 @@ main (int argc, char **argv, char **envp) #endif /* WINDOWS32 */ #endif + /* We may move, but until we do, here we are. */ + starting_directory = current_directory; + #ifdef MAKE_JOBSERVER /* If the jobserver-fds option is seen, make sure that -j is reasonable. This can't be usefully set in the makefile, and we want to verify the @@ -1667,11 +1670,8 @@ main (int argc, char **argv, char **envp) construct_include_path (include_directories == 0 ? 0 : include_directories->list); - /* Figure out where we are now, after chdir'ing. */ - if (directories == 0) - /* We didn't move, so we're still in the same place. */ - starting_directory = current_directory; - else + /* If we chdir'ed, figure out where we are now. */ + if (directories) { #ifdef WINDOWS32 if (getcwd_fs (current_directory, GET_PATH_MAX) == 0) |