Make chdir failures visible

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Alex Riesen 2008-12-05 01:36:46 +01:00 committed by Junio C Hamano
parent 47d32af233
commit 7be77de266
2 changed files with 4 additions and 3 deletions

4
git.c
View File

@ -195,8 +195,8 @@ static int handle_alias(int *argcp, const char ***argv)
ret = 1;
}
if (subdir)
chdir(subdir);
if (subdir && chdir(subdir))
die("Cannot change to %s: %s", subdir, strerror(errno));
errno = saved_errno;

View File

@ -470,7 +470,8 @@ const char *setup_git_directory_gently(int *nongit_ok)
}
die("Not a git repository");
}
chdir("..");
if (chdir(".."))
die("Cannot change to %s/..: %s", cwd, strerror(errno));
}
inside_git_dir = 0;