Skip to content
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

cleanup: fix readdir_r() usage #1054

Closed
garlick opened this issue May 8, 2017 · 2 comments
Closed

cleanup: fix readdir_r() usage #1054

garlick opened this issue May 8, 2017 · 2 comments

Comments

@garlick
Copy link
Member

garlick commented May 8, 2017

readdir_r() is used in various places throughout flux-core, but may be unnecessary and is likely to be deprecated in a future POSIX version.

The allocation of the (buffer) dirent is done on the stack in Flux, but this is not the recommended method according to readdir_r(3) (see NOTES section).

Further, the use of readdir_r() may not be necessary, since readdir() is thread safe across directory streams. Within the stream, a recursive walk can be accomplished with readdir() as long as the returned entry is not used after recursion (or is copied beforehand).

See also: https://lwn.net/Articles/696474/

@grondo
Copy link
Contributor

grondo commented May 9, 2017

Hm, had this cleanup done on the extensor branch I think. I could probably pull those out into a separate PR.

@garlick
Copy link
Member Author

garlick commented May 9, 2017

Not urgent, but welcome.

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

No branches or pull requests

2 participants