standards/188173: O_NOFOLLOW visibility not POSIX 2008 conforming
Christian Neukirchen
chneukirchen at gmail.com
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
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Apr 01 15:40:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator: Christian Neukirchen
>Release: 10.0-RELEASE
>Organization:
>Environment:
FreeBSD mneme.vuxu.org 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 root at snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
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. http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html
>How-To-Repeat:
By default, O_NOFOLLOW is defined:
% cc -E - <<EOF | tail -1
#include <fcntl.h>
O_NOFOLLOW
EOF
0x0100
But with correct _XOPEN_SOURCE, it is not:
% cc -D_XOPEN_SOURCE=700 -E - <<EOF | tail -1
#include <fcntl.h>
O_NOFOLLOW
EOF
O_NOFOLLOW
>Fix:
Adjust the condition in /usr/include/sys/fcntl.h to use _POSIX_C_SOURCE >= 200809
#if __BSD_VISIBLE
#define O_NOFOLLOW 0x0100 /* don't follow symlinks */
#endif
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-standards
mailing list