From: Michael Haggerty Date: Sat, 29 Sep 2012 06:15:55 GMT Subject: [PATCH v2 2/9] real_path_internal(): add comment explaining use of cwd Message-ID: <1348899362-4057-3-git-send-email-mhagger@alum.mit.edu> In-Reply-To: <1348899362-4057-1-git-send-email-mhagger@alum.mit.edu> Signed-off-by: Michael Haggerty --- abspath.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/abspath.c b/abspath.c index a7ab8e9..f8a526f 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; -- 1.7.11.3