Skip to content

Commit de6c51e

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 0634106 commit de6c51e

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
@@ -742,7 +742,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
742742
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
743743
{
744744
int namelen;
745-
char alt_name[PATH_MAX];
745+
char alt_name[MAX_LONG_PATH];
746746

747747
if (!do_lstat(follow, file_name, buf))
748748
return 0;
@@ -758,7 +758,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
758758
return -1;
759759
while (namelen && file_name[namelen-1] == '/')
760760
--namelen;
761-
if (!namelen || namelen >= PATH_MAX)
761+
if (!namelen || namelen >= MAX_LONG_PATH)
762762
return -1;
763763

764764
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)