standards/188173: O_NOFOLLOW visibility not POSIX 2008 conforming

Christian Neukirchen chneukirchen at
Tue Apr 1 15:40:01 UTC 2014

>Number:         188173
>Category:       standards
>Synopsis:       O_NOFOLLOW visibility not POSIX 2008 conforming
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 01 15:40:00 UTC 2014
>Originator:     Christian Neukirchen
>Release:        10.0-RELEASE
FreeBSD 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014     root at  amd64
The macro O_NOFOLLOW is not defined when _XOPEN_SOURCE is set, but it should be defined with _XOPEN_SOURCE=700 since X/Open 7 incorporates POSIX 2008, which defines O_NOFOLLOW, cf.
By default, O_NOFOLLOW is defined:

% cc -E - <<EOF | tail -1 
#include <fcntl.h>

But with correct _XOPEN_SOURCE, it is not:

% cc -D_XOPEN_SOURCE=700 -E - <<EOF | tail -1
#include <fcntl.h>

Adjust the condition in /usr/include/sys/fcntl.h to use _POSIX_C_SOURCE >= 200809

#define O_NOFOLLOW      0x0100          /* don't follow symlinks */


More information about the freebsd-standards mailing list