From owner-svn-src-all@FreeBSD.ORG Wed May 6 15:25:21 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0DF56467; Wed, 6 May 2015 15:25:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0C7E14DC; Wed, 6 May 2015 15:25:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t46FPK4h060262; Wed, 6 May 2015 15:25:20 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t46FPKlE060261; Wed, 6 May 2015 15:25:20 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201505061525.t46FPKlE060261@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 6 May 2015 15:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282550 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2015 15:25:21 -0000 Author: jhb Date: Wed May 6 15:25:20 2015 New Revision: 282550 URL: https://svnweb.freebsd.org/changeset/base/282550 Log: A few style fixes and expand the comment a bit on what _fixtelldir() is doing. Modified: head/lib/libc/gen/telldir.c Modified: head/lib/libc/gen/telldir.c ============================================================================== --- head/lib/libc/gen/telldir.c Wed May 6 15:20:50 2015 (r282549) +++ head/lib/libc/gen/telldir.c Wed May 6 15:25:20 2015 (r282550) @@ -101,11 +101,12 @@ _seekdir(dirp, loc) return; if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek) return; - /* If it's within the same chunk of data, don't bother reloading */ + + /* If it's within the same chunk of data, don't bother reloading. */ if (lp->loc_seek == dirp->dd_seek) { /* * If we go back to 0 don't make the next readdir - * trigger a call to getdirentries() + * trigger a call to getdirentries(). */ if (lp->loc_loc == 0) dirp->dd_flags |= __DTF_SKIPREAD; @@ -124,10 +125,13 @@ _seekdir(dirp, loc) } /* - * when we do a read and cross a boundary, any telldir we - * just did will have wrong information in it. - * We need to move it from "beyond the end of the previous chunk" - * to "the beginning of the new chunk" + * A call to telldir after readdir returns the last entry in a block + * returns a location that is after the end of the last entry in that + * block. However, that location doesn't refer to a valid directory + * entry. Instead, these locations should refer to the first entry in + * the next block. That location is not known until the next block is + * read, so readdir calls this function after fetching a new block to + * fix any such telldir locations. */ void _fixtelldir(DIR *dirp, long oldseek, long oldloc)