Date: Wed, 3 Sep 2014 19:01:34 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271048 - head/lib/libc/gen Message-ID: <201409031901.s83J1Yrw093019@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Sep 3 19:01:34 2014 New Revision: 271048 URL: http://svnweb.freebsd.org/changeset/base/271048 Log: 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 Modified: head/lib/libc/gen/rewinddir.c Modified: head/lib/libc/gen/rewinddir.c ============================================================================== --- head/lib/libc/gen/rewinddir.c Wed Sep 3 18:51:33 2014 (r271047) +++ head/lib/libc/gen/rewinddir.c Wed Sep 3 19:01:34 2014 (r271048) @@ -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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409031901.s83J1Yrw093019>