]> sourceware.org Git - newlib-cygwin.git/commitdiff
* mingwex/dirent.c (_treaddir): Reset errno to 0 if end
authorDanny Smith <dannysmith@users.sourceforge.net>
Thu, 2 Oct 2003 21:29:51 +0000 (21:29 +0000)
committerDanny Smith <dannysmith@users.sourceforge.net>
Thu, 2 Oct 2003 21:29:51 +0000 (21:29 +0000)
of directory.

winsup/mingw/ChangeLog
winsup/mingw/mingwex/dirent.c

index 212a47c7be161267935cdca38ae3e9fbe92feb59..2ccd1400be7ae615c374eba75f786ea23152602d 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-03  Danny Smith  <dannysmith@users.sourceforge.net>
+
+       * mingwex/dirent.c (_treaddir): Reset errno to 0 if end
+       of directory.
+
 2003-09-29  Danny Smith  <dannysmith@users.sourceforge.net>
 
        * include/stdlib.h: Guard non-ISO functions with
index e3c81e1b2bc2aeb9c5148d308b040f37bce098b8..bef2222cb154c4074d5aea19ac758df6051c35e5 100644 (file)
@@ -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;
This page took 0.035266 seconds and 5 git commands to generate.