From owner-cvs-all@FreeBSD.ORG Tue May 6 05:45:59 2008 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BFD31065675; Tue, 6 May 2008 05:45:59 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 540F58FC1C; Tue, 6 May 2008 05:45:59 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m465jxGa013994; Tue, 6 May 2008 05:45:59 GMT (envelope-from das@repoman.freebsd.org) Received: (from das@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m465jx4O013993; Tue, 6 May 2008 05:45:59 GMT (envelope-from das) Message-Id: <200805060545.m465jx4O013993@repoman.freebsd.org> From: David Schultz Date: Tue, 6 May 2008 05:45:59 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: RELENG_7 Cc: Subject: cvs commit: src/lib/libc/gen scandir.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2008 05:45:59 -0000 das 2008-05-06 05:45:58 UTC FreeBSD src repository Modified files: (Branch: RELENG_7) lib/libc/gen scandir.c Log: MFC scandir.c,v 1.9 scandir(3) previously used st_size to obtain an initial estimate of the array length needed to store all the directory entries. Although BSD has historically guaranteed that st_size is the size of the directory file, POSIX does not, and more to the point, some recent filesystems such as ZFS use st_size to mean something else. The fix is to not stat the directory at all, set the initial array size to 32 entries, and realloc it in powers of 2 if that proves insufficient. PR: 113668 Revision Changes Path 1.8.2.1 +3 -13 src/lib/libc/gen/scandir.c