]> git.ipfire.org Git - thirdparty/git.git/commitdiff
real_path_internal(): add comment explaining use of cwd
authorMichael Haggerty <mhagger@alum.mit.edu>
Sun, 28 Oct 2012 16:16:21 +0000 (17:16 +0100)
committerJeff King <peff@peff.net>
Mon, 29 Oct 2012 06:34:57 +0000 (02:34 -0400)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
abspath.c

index a7ab8e908f8188ae1b55fca15cc2fb8772f40096..f8a526f3916d753addac6acce1986cd3079472b8 100644 (file)
--- 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;