Skip to content

Commit af8e6c9

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 a1b2ddf commit af8e6c9

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
@@ -926,7 +926,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
926926
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
927927
{
928928
int namelen;
929-
char alt_name[PATH_MAX];
929+
char alt_name[MAX_LONG_PATH];
930930

931931
if (!do_lstat(follow, file_name, buf))
932932
return 0;
@@ -942,7 +942,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
942942
return -1;
943943
while (namelen && file_name[namelen-1] == '/')
944944
--namelen;
945-
if (!namelen || namelen >= PATH_MAX)
945+
if (!namelen || namelen >= MAX_LONG_PATH)
946946
return -1;
947947

948948
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)