NetBSD: fix getmntinfo for NetBSD #4265
Open
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This patch fixes libc::getmntinfo on NetBSD.
Sources
The problem is that NetBSD provides binary compatibility in a way that was not considered when initially providing the implementation.
Once a symbol name has been used, it stays the same, so the original
getmntinfo()
in NetBSD, usingstruct statfs
, will always be available asgetmntinfo
. Whengetmntinfo
was changed to providestruct statvfs
(note the 'v') a long time ago, a new symbol was introduced,__getmntinfo13
and the system headers rename access togetmntinfo
to call__getmntinfo13
instead.The rust implementation called the old symbol (providing
struct statfs
) but parsed the returned information asstruct statvfs
, leading to wrong data and segfaults.Checklist
The change has been tested on NetBSD 9, 10, and -current (all supported versions).
No compatibility for NetBSD 8 or older is required, since these versions are not supported any longer; the symbol rename happened before NetBSD 9.