From d6052abca39fc84fed4f3248be042cfb6bf635d5 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sun, 28 Oct 2012 17:16:21 +0100 Subject: [PATCH] real_path_internal(): add comment explaining use of cwd Signed-off-by: Michael Haggerty Signed-off-by: Jeff King --- abspath.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/abspath.c b/abspath.c index a7ab8e908..f8a526f39 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; -- 2.26.2