Skip to content

Commit 538f855

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 5eb8d3a commit 538f855

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

872872
if (!do_lstat(follow, file_name, buf))
873873
return 0;
@@ -883,7 +883,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
883883
return -1;
884884
while (namelen && file_name[namelen-1] == '/')
885885
--namelen;
886-
if (!namelen || namelen >= PATH_MAX)
886+
if (!namelen || namelen >= MAX_LONG_PATH)
887887
return -1;
888888

889889
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)