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>
Erik Faye-Lund committed
Nov 23, 2010 at 19:38 UTC
e7772600e94146ddbf5ef6b08d0ea7d6fc8fbcad
1 file changed
+2
compat/msvc.c
+2
@@ -23,6 +23,8 @@ DIR *opendir(const char *name)
23
24
/* check that the pattern won't be too long for FindFirstFileA */
25
len = strlen(name);
26
+ if (is_dir_sep(name[len - 1]))
27
+ len--;
28
if (len + 2 >= MAX_PATH) {
29
errno = ENAMETOOLONG;
30
return NULL;