Skip to content

Commit 413072a

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 e6fdb12 commit 413072a

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
@@ -899,7 +899,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
899899
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
900900
{
901901
int namelen;
902-
char alt_name[PATH_MAX];
902+
char alt_name[MAX_LONG_PATH];
903903

904904
if (!do_lstat(follow, file_name, buf))
905905
return 0;
@@ -915,7 +915,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
915915
return -1;
916916
while (namelen && file_name[namelen-1] == '/')
917917
--namelen;
918-
if (!namelen || namelen >= PATH_MAX)
918+
if (!namelen || namelen >= MAX_LONG_PATH)
919919
return -1;
920920

921921
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)