Date: Mon, 8 Sep 2014 14:45:58 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r271263 - stable/10/lib/libc/gen Message-ID: <201409081445.s88Ejwii006892@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Mon Sep 8 14:45:58 2014 New Revision: 271263 URL: http://svnweb.freebsd.org/changeset/base/271263 Log: MFC 271048: 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 Approved by: re (gjb) Modified: stable/10/lib/libc/gen/rewinddir.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/rewinddir.c ============================================================================== --- stable/10/lib/libc/gen/rewinddir.c Mon Sep 8 12:26:52 2014 (r271262) +++ stable/10/lib/libc/gen/rewinddir.c Mon Sep 8 14:45:58 2014 (r271263) @@ -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?201409081445.s88Ejwii006892>