Skip to content

Commit 4db6afd

Browse files
kbleesGit for Windows Build Agent
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 c7cf584 commit 4db6afd

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
@@ -837,7 +837,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
837837
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
838838
{
839839
int namelen;
840-
char alt_name[PATH_MAX];
840+
char alt_name[MAX_LONG_PATH];
841841

842842
if (!do_lstat(follow, file_name, buf))
843843
return 0;
@@ -853,7 +853,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
853853
return -1;
854854
while (namelen && file_name[namelen-1] == '/')
855855
--namelen;
856-
if (!namelen || namelen >= PATH_MAX)
856+
if (!namelen || namelen >= MAX_LONG_PATH)
857857
return -1;
858858

859859
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)