Skip to content

Commit a52969e

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 66ef056 commit a52969e

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
@@ -636,7 +636,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
636636
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
637637
{
638638
int namelen;
639-
char alt_name[PATH_MAX];
639+
char alt_name[MAX_LONG_PATH];
640640

641641
if (!do_lstat(follow, file_name, buf))
642642
return 0;
@@ -652,7 +652,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
652652
return -1;
653653
while (namelen && file_name[namelen-1] == '/')
654654
--namelen;
655-
if (!namelen || namelen >= PATH_MAX)
655+
if (!namelen || namelen >= MAX_LONG_PATH)
656656
return -1;
657657

658658
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)