diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2003-10-03 01:29:51 +0400 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2003-10-03 01:29:51 +0400 |
commit | c536f54adab29e9646a91639ce205ec91b1f9234 (patch) | |
tree | dd216ce22553db3a70c37c088993b74c04a025ef /winsup/mingw/mingwex | |
parent | 3a3f30763c4a4f467d77e168b91065997942fc5f (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.c | 7 |
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; |