Author: jhb
Date: Thu Jul 24 20:44:30 2014
New Revision: 269079
URL: http://svnweb.freebsd.org/changeset/base/269079

Log:
  POSIX says that passing a location returned by telldir() to seekdir()
  after an intervening call to rewinddir() is undefined, so reclaim any
  pending telldir() cookies in the directory when rewinddir() is called.
  
  CR:           D459
  Reviewed by:  jilles
  MFC after:    1 week

Modified:
  head/lib/libc/gen/rewinddir.c

Modified: head/lib/libc/gen/rewinddir.c
==============================================================================
--- head/lib/libc/gen/rewinddir.c       Thu Jul 24 20:16:45 2014        
(r269078)
+++ head/lib/libc/gen/rewinddir.c       Thu Jul 24 20:44:30 2014        
(r269079)
@@ -58,6 +58,7 @@ rewinddir(dirp)
                dirp->dd_seek = 0;
        }
        dirp->dd_loc = 0;
+       _reclaim_telldir(dirp);
        if (__isthreaded)
                _pthread_mutex_unlock(&dirp->dd_lock);
 }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to