From: Andrew Crabtree Message-Id: <199805271842.AA296474555@typhoon.rose.hp.com> Subject: Re: BUG in readdir libc function To: nate AT cartsys DOT com (Nate Eldredge) Date: Wed, 27 May 1998 11:42:34 PDT Cc: erikyyy AT studbox DOT uni-stuttgart DOT de, djgpp-workers AT delorie DOT com In-Reply-To: <19980527010023.AAO19094@ppp114.cartsys.com>; from "Nate Eldredge" at May 26, 98 6:01 pm Reply-To: andrewc AT rosemail DOT rose DOT hp DOT com Precedence: bulk > >readdir DOESN'T SET errno TO 0, if it returns 0 and the > >directory is at its end !!!!!!!!!!!!!! Sounds typical. > Can somebody check what POSIX has to say about this? OK (hand transcribed) - ISO/IEC 9945-1 : 1990 IEEE Std 1003.1 - 1990 5.1.2.3 Returns <...> Upons successful completioon, readdir() returns a pointer to an object of type struct dirent. When an error is encountered, a value of NULL is returned and errno is set to indicate the error. When the end of the directory is encountered, a value of NULL is returned and errno is unchanged bu this function call. > Thus, you can get the desired behavior by setting `errno=0' > yourself beforehand. Is that what one's supposed to do? Seems like that would be the way to do it. Andy -- _______ ___________________________________________________________ / Andrew Crabtree / Workgroup Networks Division ____ ___ / Hewlett-Packard / / / / Roseville, CA __/ __/ _____/ 916/785-1675 / andrewc AT rosemail DOT rose DOT hp DOT com ___________ __/ _____________________________________________________