Skip to content

Commit

Permalink
Fix NCclosedir in dpathmgr.c
Browse files Browse the repository at this point in the history
re: Issue Unidata#1999

NCclosedir code is incorrect. Fix.
Note that this issue crops up when using a non-VisualStudio windows build
such as Mingw because Mingq defines dirent.h, but Visual Studio does not.
  • Loading branch information
DennisHeimbigner committed May 18, 2021
1 parent 44d9d36 commit 51fa5fc
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions libdispatch/dpathmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,7 @@ int
NCclosedir(DIR* ent)
{
int stat = NC_NOERR;
char* cvtname = NCpathcvt(path);
if(cvtname == NULL) {errno = ENOENT; return -1;}
stat = closedir(cvtname);
free(cvtname);
if(closedir(ent) < 0) stat = errno;
return stat;
}
#endif
Expand Down Expand Up @@ -911,33 +908,3 @@ printutf8hex(const char* s, char* sx)
}
*q = '\0';
}

/**************************************************/
#if 0
#ifdef HAVE_DIRENT_H
EXTERNL
DIR*
NCopendir(const char* path)
{
DIR* ent = NULL;
char* cvtpath = NCpathcvt(path);
if(cvtpath == NULL) return -1;
ent = opendir(cvtpath);
free(cvtpath);
return ent;
}

EXTERNL
int
NCclosedir(DIR* ent)
{
int stat = 0;
char* cvtpath = NCpathcvt(path);
if(cvtpath == NULL) return -1;
stat = closedir(cvtpath);
free(cvtpath);
return stat;
}
#endif
#endif /*0*/

0 comments on commit 51fa5fc

Please sign in to comment.