Skip to content

Commit d7f4f8b

Browse files
kbleesGit for Windows Build Agent
authored andcommitted
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 cac299e commit d7f4f8b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compat/mingw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
677677
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
678678
{
679679
int namelen;
680-
char alt_name[PATH_MAX];
680+
char alt_name[MAX_LONG_PATH];
681681

682682
if (!do_lstat(follow, file_name, buf))
683683
return 0;
@@ -693,7 +693,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
693693
return -1;
694694
while (namelen && file_name[namelen-1] == '/')
695695
--namelen;
696-
if (!namelen || namelen >= PATH_MAX)
696+
if (!namelen || namelen >= MAX_LONG_PATH)
697697
return -1;
698698

699699
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)