Skip to content

Commit e777260

Browse files
kusmagitster
authored andcommitted
msvc: opendir: handle paths ending with a slash
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9585ed5 commit e777260

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compat/msvc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ DIR *opendir(const char *name)
2323

2424
/* check that the pattern won't be too long for FindFirstFileA */
2525
len = strlen(name);
26+
if (is_dir_sep(name[len - 1]))
27+
len--;
2628
if (len + 2 >= MAX_PATH) {
2729
errno = ENAMETOOLONG;
2830
return NULL;

0 commit comments

Comments
 (0)