summaryrefslogtreecommitdiff
path: root/abspath.c
diff options
context:
space:
mode:
Diffstat (limited to 'abspath.c')
-rw-r--r--abspath.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/abspath.c b/abspath.c
index ca33558a91..c0c868fc22 100644
--- a/abspath.c
+++ b/abspath.c
@@ -41,7 +41,7 @@ static const char *real_path_internal(const char *path, int die_on_error)
* here so that we can chdir() back to it at the end of the
* function:
*/
- char cwd[1024] = "";
+ static char cwd[PATH_MAX];
int buf_index = 1;
@@ -49,6 +49,8 @@ static const char *real_path_internal(const char *path, int die_on_error)
char *last_elem = NULL;
struct stat st;
+ *cwd = '\0';
+
/* We've already done it */
if (path == buf || path == next_buf)
return path;