From owner-freebsd-bugs Wed Apr 12 15:37:50 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id PAA28768 for bugs-outgoing; Wed, 12 Apr 1995 15:37:50 -0700 Received: from cs.weber.edu (cs.weber.edu [137.190.16.16]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id PAA28756 for ; Wed, 12 Apr 1995 15:37:45 -0700 Received: by cs.weber.edu (4.1/SMI-4.1.1) id AA19462; Wed, 12 Apr 95 16:30:39 MDT From: terry@cs.weber.edu (Terry Lambert) Message-Id: <9504122230.AA19462@cs.weber.edu> Subject: Re: seekdir bug To: bde@zeta.org.au (Bruce Evans) Date: Wed, 12 Apr 95 16:30:38 MDT Cc: bugs@FreeBSD.org, craig@munich.gcomm.com In-Reply-To: <199504122052.GAA25937@godzilla.zeta.org.au> from "Bruce Evans" at Apr 13, 95 06:52:28 am X-Mailer: ELM [version 2.4dev PL52] Sender: bugs-owner@FreeBSD.org Precedence: bulk > The man page says that "Values returned by telldir() are good only for > the lifetime of the DIR pointer, dirp, from which they are derived." > However, it also says that "It is safe to use a previous telldir() value > immediately after a call to opendir() and before any calls to > readdir()." The second statement is now wrong because telldir() cookies > are reclaimed in closedir(). telldir() cookies are malloc()ed and (I > think) the memory for them used to be lost in closedir(). It's safe to use, but it may result in seekdir() succeeding and a subsequent readdir() returning NULL for a read at the now invalid position. Oh, non-linear iteration of directory entries should be banned, yes indeedy. 8-(. Terry Lambert terry@cs.weber.edu --- Any opinions in this posting are my own and not those of my present or previous employers.