Skip to content

Commit 403b1aa

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 2bd6fef commit 403b1aa

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
@@ -842,7 +842,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
842842
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
843843
{
844844
int namelen;
845-
char alt_name[PATH_MAX];
845+
char alt_name[MAX_LONG_PATH];
846846

847847
if (!do_lstat(follow, file_name, buf))
848848
return 0;
@@ -858,7 +858,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
858858
return -1;
859859
while (namelen && file_name[namelen-1] == '/')
860860
--namelen;
861-
if (!namelen || namelen >= PATH_MAX)
861+
if (!namelen || namelen >= MAX_LONG_PATH)
862862
return -1;
863863

864864
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)