diff options
author | jhb <jhb@FreeBSD.org> | 2014-07-24 20:44:30 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-07-24 20:44:30 +0000 |
commit | c6ab5d746c37cac49f50a1579f5d9147ad4c176d (patch) | |
tree | 334a1dc197b146069290e3474fae55b77d4b2be5 /lib/libc | |
parent | 68a15d81dea2e28ae62170e5a4e23d200d0c3e9f (diff) | |
download | FreeBSD-src-c6ab5d746c37cac49f50a1579f5d9147ad4c176d.zip FreeBSD-src-c6ab5d746c37cac49f50a1579f5d9147ad4c176d.tar.gz |
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
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/rewinddir.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c index e1168b3..89e717c 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); } |