On Wed, Jul 20, 2011 at 07:29:13PM +0200, Alexandre Julliard wrote:
Grazvydas Ignotas notasas@gmail.com writes:
Here is another idea:
It seems getdents64 is indeed returning "." and "..", but not necessarily first, like Windows does. I think we could swap first 2 entries returned, whatever they are, with "." and "..". It would work like this:
- read the 2 first entries to advance file pointer, but ignore them,
return "." or ".." instead
- return other entries normally
- after "." or ".." is encountered, save current file offset and seek
to first or second entry (respectively) and return that instead. For a corner case where that spot has ".." or ".", return the other one of first 2.
- seek back where we were
I think this would also fix fake_dot_dot + single_entry case. What do you think?
That could probably be made to work, yes.
Remember that you can only seek to the offsets returned by the OS. Directory offsets aren't necessarily byte offsets. (They may be 64bit values even for small directories.)
David