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

A few portability issues with the use of dirent for validating forcing file paths in model engine. #517

Closed
hellkite500 opened this issue Apr 25, 2023 · 0 comments · Fixed by #518

Comments

@hellkite500
Copy link
Member

In this directory iteration loop in the FormulationManager, there are two potential issues.

First, according to the documentation, d_type is not guaranteed to be a member of the dirent struct on all systems, so this requires a macro guard using #ifdef _DIRENT_HAVE_D_TYPE to prevent compiler errors on such systems.

Second, d_type is not guaranteed to be provided by all file systems. As such, a fallback to stat is required for cases when DT_UNKOWN is returned. Note that reading the dirent struct is more efficient, and should be tried first, but this fallback is needed as well.

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 a pull request may close this issue.

1 participant