Skip to content

Commit d6052ab

Browse files
mhaggerpeff
authored andcommitted
real_path_internal(): add comment explaining use of cwd
Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 038e55f commit d6052ab

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

abspath.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ static const char *real_path_internal(const char *path, int die_on_error)
3535
{
3636
static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];
3737
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+
*/
3844
char cwd[1024] = "";
45+
3946
int buf_index = 1;
4047

4148
int depth = MAXDEPTH;

0 commit comments

Comments
 (0)