summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-09-18 19:29:28 -0400
committerPaul Smith <psmith@gnu.org>2013-09-18 19:29:28 -0400
commit30a5ee0d8551ea1879b0c7638f455d956456cee1 (patch)
tree7b9d400e49cb245887fcfd6ce45c6bad32e665a6
parent8a6205b43f6224dfaa759ce73d7b1c9772b6d645 (diff)
downloadgunmake-30a5ee0d8551ea1879b0c7638f455d956456cee1.tar.gz
[SV 40043] Set the current directory before printing errors.
-rw-r--r--ChangeLog5
-rw-r--r--main.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a9e3d36..8fb2037 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-18 Paul Smith <psmith@gnu.org>
+
+ * main.c (main): Set starting_directory before we write any
+ errors. Fixes Savannah bug #40043.
+
2013-09-16 Eli Zaretskii <eliz@gnu.org>
* output.c [WINDOWS32]: Include windows.h and sub_proc.h, to avoid
diff --git a/main.c b/main.c
index 03f5418..059f5b5 100644
--- a/main.c
+++ b/main.c
@@ -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)