Skip to content

Commit b2b6cb3

Browse files
kbleesGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Win32: fix 'lstat("dir/")' with long paths
Use a suffciently large buffer to strip the trailing slash. Signed-off-by: Karsten Blees <[email protected]>
1 parent 46ea12e commit b2b6cb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compat/mingw.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
10131013
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10141014
{
10151015
size_t namelen;
1016-
char alt_name[PATH_MAX];
1016+
char alt_name[MAX_LONG_PATH];
10171017

10181018
if (!do_lstat(follow, file_name, buf))
10191019
return 0;
@@ -1029,7 +1029,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10291029
return -1;
10301030
while (namelen && file_name[namelen-1] == '/')
10311031
--namelen;
1032-
if (!namelen || namelen >= PATH_MAX)
1032+
if (!namelen || namelen >= MAX_LONG_PATH)
10331033
return -1;
10341034

10351035
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)