diff --git a/fcaseopen.c b/fcaseopen.c index 6ae8e22..c8e9519 100644 --- a/fcaseopen.c +++ b/fcaseopen.c @@ -30,7 +30,6 @@ static int casepath(char const *path, char *r) rl = 1; } - int last = 0; char *c = strsep(&p, "/"); while (c) { @@ -39,12 +38,6 @@ static int casepath(char const *path, char *r) return 0; } - if (last) - { - closedir(d); - return 0; - } - r[rl] = '/'; rl += 1; r[rl] = 0; @@ -70,7 +63,9 @@ static int casepath(char const *path, char *r) { strcpy(r + rl, c); rl += strlen(c); - last = 1; + + if(d) closedir(d); + return 0; } c = strsep(&p, "/");