Skip to content

Commit 792851b

Browse files
kbleesdscho
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 b7ec746 commit 792851b

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
@@ -679,7 +679,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
679679
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
680680
{
681681
int namelen;
682-
char alt_name[PATH_MAX];
682+
char alt_name[MAX_LONG_PATH];
683683

684684
if (!do_lstat(follow, file_name, buf))
685685
return 0;
@@ -695,7 +695,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
695695
return -1;
696696
while (namelen && file_name[namelen-1] == '/')
697697
--namelen;
698-
if (!namelen || namelen >= PATH_MAX)
698+
if (!namelen || namelen >= MAX_LONG_PATH)
699699
return -1;
700700

701701
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)