Date: Wed, 12 Apr 95 16:30:38 MDT From: terry@cs.weber.edu (Terry Lambert) To: bde@zeta.org.au (Bruce Evans) Cc: bugs@FreeBSD.org, craig@munich.gcomm.com Subject: Re: seekdir bug Message-ID: <9504122230.AA19462@cs.weber.edu> In-Reply-To: <199504122052.GAA25937@godzilla.zeta.org.au> from "Bruce Evans" at Apr 13, 95 06:52:28 am
next in thread | previous in thread | raw e-mail | index | archive | help
> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9504122230.AA19462>