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>

Michael Haggerty committed Oct 28, 2012 at 17:16 UTC d6052abca39fc84fed4f3248be042cfb6bf635d5
1 file changed +7
abspath.c
+7
@@ -35,7 +35,14 @@ static const char *real_path_internal(const char *path, int die_on_error)
35 {
36 static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];
37 char *retval = NULL;
38 +
39 + /*
40 + * If we have to temporarily chdir(), store the original CWD
41 + * here so that we can chdir() back to it at the end of the
42 + * function:
43 + */
44 char cwd[1024] = "";
45 +
46 int buf_index = 1;
47
48 int depth = MAXDEPTH;