Skip to content

Use index rather than telldir/seekdir to represent fd_readdir cookie #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

CPunisher
Copy link

Fixes: nodejs/node#47193

How telldir and seekdir work depends on the operating system. For example, in ubuntu, telldir returns a relative pos of current dirent iterator. But in macos, telldir returns a self-incrementing counter, which is only valid for one DIR*.

The issue is that every single call to fd_readdir opens and closes the dir, so the cookie becomes invalid on the next call, thus getting infinite loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WASI preview 1: fd_readdir ignores cookie argument
1 participant