Unix.link: include errno.h, correctly set feature test macro#1862
Unix.link: include errno.h, correctly set feature test macro#1862gasche merged 1 commit intoocaml:trunkfrom
Conversation
|
I started a precheck build for this branch, https://ci.inria.fr/ocaml/job/precheck/120/. I think this should be merged if it passes. (For documentation on what precheck is and how to use it, see CONTRIBUTING.md#precheck) |
otherlibs/unix/link.c
Outdated
| /* */ | ||
| /**************************************************************************/ | ||
|
|
||
| /* Needed te get linkat exposed in compliant OS. |
There was a problem hiding this comment.
Typo: "te" instead of "to".
|
(Not all tests are done but the freebsd-64 build just passed, which is good indication that the new feature test seems to work.) |
Which is needed for the case without support for linkat as reported by Gabriel Scherer. Also set _XOPEN_SOURCE == 700 instead of testing for it. Test for availablility of linkat by looking at AT_SYMLINK_FOLLOW, which is, according to introduced in POSIX IEEE Std 1003.1-2008 for linkat.
|
... or it indicates that the |
gasche
left a comment
There was a problem hiding this comment.
For some reasons the OSX builds have not finished, but this already fixes the build on FreeBSD (and the rest still builds) so I'm happy to accept and merge -- cannot hurt.
In #1061 builds on FreeBSD and MacOS broke.
The break is caused by wrong use of feature test macros. It turns out those feature test macros are not used for testing for features, but to request them.
Therefore in this fix I first
#define _XOPEN_SOURCE 700instead of testing for it.Then I test for availablility of
linkatby looking at theAT_SYMLINK_FOLLOWmacro, which was introduced in POSIX IEEE Std 1003.1-2008 forlinkat.