Skip to content

Commit d5df057

Browse files
kbleesvdye
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 0a6c2b2 commit d5df057

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
@@ -869,7 +869,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
869869
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
870870
{
871871
int namelen;
872-
char alt_name[PATH_MAX];
872+
char alt_name[MAX_LONG_PATH];
873873

874874
if (!do_lstat(follow, file_name, buf))
875875
return 0;
@@ -885,7 +885,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
885885
return -1;
886886
while (namelen && file_name[namelen-1] == '/')
887887
--namelen;
888-
if (!namelen || namelen >= PATH_MAX)
888+
if (!namelen || namelen >= MAX_LONG_PATH)
889889
return -1;
890890

891891
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)