|
Message-ID: <8735xmvdpf.fsf@oldenburg.str.redhat.com> Date: Tue, 23 Feb 2021 19:30:52 +0100 From: Florian Weimer <fweimer@...hat.com> To: enh <enh@...gle.com> Cc: libc-coord@...ts.openwall.com, Rich Felker <dalias@...c.org> Subject: Re: Lifetime of object returned by readdir > POSIX already explicitly says that seekdir() affects the _next_ > readdir(). That's because it's the only way its effect is observable. The glibc implementation of seekdir performs an immediate seek, but if the seek fails, that error is not really observable (except for reading the implementation and inferring that the errno = 0 hack will work). I had not realized that seekdir returns void. Maybe that argues in favor of a delayed seek upon the next readdir call. > does anyone have an implementation where rewinddir()/seekdir() > actually invalidate the previous readdir()? seems unlikely? Probably not. But there's also the issue of fitting the directory offset (usually off64_t, maybe even something larger) into the long int return value of telldir, so there could be quite a bit of magic going on in the background (considering that telldir cannot indicate failure). Thanks, Florian
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.