Skip to content

Commit 5d0b4ec

Browse files
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 1ccf877 commit 5d0b4ec

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
@@ -560,7 +560,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
560560
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
561561
{
562562
int namelen;
563-
char alt_name[PATH_MAX];
563+
char alt_name[MAX_LONG_PATH];
564564

565565
if (!do_lstat(follow, file_name, buf))
566566
return 0;
@@ -576,7 +576,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
576576
return -1;
577577
while (namelen && file_name[namelen-1] == '/')
578578
--namelen;
579-
if (!namelen || namelen >= PATH_MAX)
579+
if (!namelen || namelen >= MAX_LONG_PATH)
580580
return -1;
581581

582582
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)