summaryrefslogtreecommitdiff
path: root/abspath.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2012-10-28 17:16:21 +0100
committerJeff King <peff@peff.net>2012-10-29 02:34:57 -0400
commitd6052abca39fc84fed4f3248be042cfb6bf635d5 (patch)
tree51d37ae6dc4d1cfd8ba0521b7c90042e7daf5659 /abspath.c
parent038e55fec2153a8195236d57dced4bbb001ccf3c (diff)
downloadgit-d6052abca39fc84fed4f3248be042cfb6bf635d5.tar.gz
real_path_internal(): add comment explaining use of cwd
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'abspath.c')
-rw-r--r--abspath.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/abspath.c b/abspath.c
index a7ab8e908f..f8a526f391 100644
--- a/abspath.c
+++ b/abspath.c
@@ -35,7 +35,14 @@ static const char *real_path_internal(const char *path, int die_on_error)
{
static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];
char *retval = NULL;
+
+ /*
+ * If we have to temporarily chdir(), store the original CWD
+ * here so that we can chdir() back to it at the end of the
+ * function:
+ */
char cwd[1024] = "";
+
int buf_index = 1;
int depth = MAXDEPTH;