summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-09-03 19:01:34 +0000
committerjhb <jhb@FreeBSD.org>2014-09-03 19:01:34 +0000
commit51325ca40daf5aca4e204816ef6c7edfa910c4f2 (patch)
tree1dcf82ced39f30ad47930f75c5ea03d2fea4dd3f /lib
parentd1650d164a6dbe1e85601ed9abf0f5fae6d6a5e7 (diff)
downloadFreeBSD-src-51325ca40daf5aca4e204816ef6c7edfa910c4f2.zip
FreeBSD-src-51325ca40daf5aca4e204816ef6c7edfa910c4f2.tar.gz
Always seek back to the beginning of a regular directory, even if the
previous seek location was 0. Without this, readdir() would see dd_loc of zero and call getdirentries() which would start reading entries at the current seek location of the directory ignoring the first batch of entries. Also, rewinddir() should always seek so that it reads the directory from the beginning to get updated entries. PR: 192935 Reported by: iron@mail.ua MFC after: 3 days
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/rewinddir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c
index 89e717c..193f4b0 100644
--- a/lib/libc/gen/rewinddir.c
+++ b/lib/libc/gen/rewinddir.c
@@ -53,7 +53,7 @@ rewinddir(dirp)
_pthread_mutex_lock(&dirp->dd_lock);
if (dirp->dd_flags & __DTF_READALL)
_filldir(dirp, false);
- else if (dirp->dd_seek != 0) {
+ else {
(void) lseek(dirp->dd_fd, 0, SEEK_SET);
dirp->dd_seek = 0;
}
OpenPOWER on IntegriCloud