Skip to content

Commit 03e1632

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 dd7f4ea commit 03e1632

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
@@ -773,7 +773,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
773773
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
774774
{
775775
int namelen;
776-
char alt_name[PATH_MAX];
776+
char alt_name[MAX_LONG_PATH];
777777

778778
if (!do_lstat(follow, file_name, buf))
779779
return 0;
@@ -789,7 +789,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
789789
return -1;
790790
while (namelen && file_name[namelen-1] == '/')
791791
--namelen;
792-
if (!namelen || namelen >= PATH_MAX)
792+
if (!namelen || namelen >= MAX_LONG_PATH)
793793
return -1;
794794

795795
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)