summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1993-03-08 18:49:51 +0000
committerRoland McGrath <roland@redhat.com>1993-03-08 18:49:51 +0000
commitd5ef06dee5ce58be7f83f94733ba7294ef126d41 (patch)
treecd0824f910dd90698c1d0165b4865b6ad9f5c66f /main.c
parent7c675f86e6a3f98664f91accb194a324e449f7e2 (diff)
downloadgunmake-d5ef06dee5ce58be7f83f94733ba7294ef126d41.tar.gz
Formerly main.c.~73~
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main.c b/main.c
index 2c3a107..9df61e3 100644
--- a/main.c
+++ b/main.c
@@ -373,6 +373,7 @@ main (argc, argv, envp)
register struct dep *lastgoal;
struct dep *read_makefiles;
PATH_VAR (current_directory);
+ char *directory_before_chdir;
default_goal_file = 0;
reading_filename = 0;
@@ -461,7 +462,11 @@ main (argc, argv, envp)
error ("getwd: %s", current_directory);
#endif
current_directory[0] = '\0';
+ directory_before_chdir = 0;
}
+ else
+ directory_before_chdir = savestring (current_directory,
+ strlen (current_directory));
/* Read in variables from the environment. It is important that this be
done before `MAKE' and `MAKEOVERRIDES' are figured out so their
@@ -939,9 +944,9 @@ main (argc, argv, envp)
if (directories != 0 && directories->idx > 0)
{
char bad;
- if (current_directory[0] != '\0')
+ if (directory_before_chdir != 0)
{
- if (chdir (current_directory) < 0)
+ if (chdir (directory_before_chdir) < 0)
{
perror_with_name ("chdir", "");
bad = 1;