Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2003-10-03 01:29:51 +0400
committerDanny Smith <dannysmith@users.sourceforge.net>2003-10-03 01:29:51 +0400
commitc536f54adab29e9646a91639ce205ec91b1f9234 (patch)
treedd216ce22553db3a70c37c088993b74c04a025ef /winsup/mingw/mingwex
parent3a3f30763c4a4f467d77e168b91065997942fc5f (diff)
* mingwex/dirent.c (_treaddir): Reset errno to 0 if end
of directory.
Diffstat (limited to 'winsup/mingw/mingwex')
-rw-r--r--winsup/mingw/mingwex/dirent.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/mingw/mingwex/dirent.c b/winsup/mingw/mingwex/dirent.c
index e3c81e1b2..bef2222cb 100644
--- a/winsup/mingw/mingwex/dirent.c
+++ b/winsup/mingw/mingwex/dirent.c
@@ -165,7 +165,12 @@ _treaddir (_TDIR * dirp)
/* Get the next search entry. */
if (_tfindnext (dirp->dd_handle, &(dirp->dd_dta)))
{
- /* We are off the end or otherwise error. */
+ /* We are off the end or otherwise error.
+ _findnext sets errno to ENOENT if no more file
+ Undo this. */
+ DWORD winerr = GetLastError();
+ if (winerr == ERROR_NO_MORE_FILES)
+ errno = 0;
_findclose (dirp->dd_handle);
dirp->dd_handle = -1;
dirp->dd_stat = -1;