From 0708297e431dbd7c8f6d0faef6a387ee733c11ed Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 24 Jul 2014 20:44:30 +0000 Subject: [PATCH] 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 --- lib/libc/gen/rewinddir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c index e1168b3570e2..89e717cbfc10 100644 --- a/lib/libc/gen/rewinddir.c +++ b/lib/libc/gen/rewinddir.c @@ -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); }