Skip to content

Commit 21af3a5

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 774868c commit 21af3a5

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
@@ -787,7 +787,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
787787
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
788788
{
789789
int namelen;
790-
char alt_name[PATH_MAX];
790+
char alt_name[MAX_LONG_PATH];
791791

792792
if (!do_lstat(follow, file_name, buf))
793793
return 0;
@@ -803,7 +803,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
803803
return -1;
804804
while (namelen && file_name[namelen-1] == '/')
805805
--namelen;
806-
if (!namelen || namelen >= PATH_MAX)
806+
if (!namelen || namelen >= MAX_LONG_PATH)
807807
return -1;
808808

809809
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)