Skip to content

Commit 7bbbaf5

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 9510c76 commit 7bbbaf5

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
@@ -618,7 +618,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
618618
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
619619
{
620620
int namelen;
621-
char alt_name[PATH_MAX];
621+
char alt_name[MAX_LONG_PATH];
622622

623623
if (!do_lstat(follow, file_name, buf))
624624
return 0;
@@ -634,7 +634,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
634634
return -1;
635635
while (namelen && file_name[namelen-1] == '/')
636636
--namelen;
637-
if (!namelen || namelen >= PATH_MAX)
637+
if (!namelen || namelen >= MAX_LONG_PATH)
638638
return -1;
639639

640640
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)