standards/188173: O_NOFOLLOW visibility not POSIX 2008 conforming

Sergey Kandaurov pluknet at gmail.com
Sat Apr 5 22:08:14 UTC 2014


On 6 April 2014 00:47, Jilles Tjoelker <jilles at stack.nl> wrote:
> On Sat, Apr 05, 2014 at 11:16:07PM +0300, Konstantin Belousov wrote:
>> On Tue, Apr 01, 2014 at 03:31:31PM +0000, Christian Neukirchen wrote:
>> > >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
>> >
>
>> Thank you for noting this. Still, I want to formally request your
>> confirmation that the following patch works for you. I only have 1003.1,
>> 2013 access right now.
>
>> diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
>> index 3461f8b..2691449 100644
>> --- a/sys/sys/fcntl.h
>> +++ b/sys/sys/fcntl.h
>> @@ -96,7 +96,7 @@ typedef     __pid_t         pid_t;
>>  #define      O_FSYNC         0x0080          /* synchronous writes */
>>  #endif
>>  #define      O_SYNC          0x0080          /* POSIX synonym for O_FSYNC */
>> -#if __BSD_VISIBLE
>> +#if __POSIX_VISIBLE >= 200809
>>  #define      O_NOFOLLOW      0x0100          /* don't follow symlinks */
>>  #endif
>>  #define      O_CREAT         0x0200          /* create if nonexistent */
>
> This looks good, but I went ahead and made the other new POSIX.1-2008
> things visible as well and removed redundant __BSD_VISIBLE condition
> parts:

It looks good to me, and I have had a subset of this change locally.

>
> Index: sys/sys/fcntl.h
> ===================================================================
> --- sys/sys/fcntl.h     (revision 263842)
> +++ sys/sys/fcntl.h     (working copy)
> @@ -96,7 +96,7 @@ typedef       __pid_t         pid_t;
>  #define        O_FSYNC         0x0080          /* synchronous writes */
>  #endif
>  #define        O_SYNC          0x0080          /* POSIX synonym for O_FSYNC */
> -#if __BSD_VISIBLE
> +#if __POSIX_VISIBLE >= 200809
>  #define        O_NOFOLLOW      0x0100          /* don't follow symlinks */
>  #endif
>  #define        O_CREAT         0x0200          /* create if nonexistent */
> @@ -115,7 +115,7 @@ typedef     __pid_t         pid_t;
>  #endif
>
>  /* Defined by POSIX Extended API Set Part 2 */

I'd also remove this line as well. It looks useless now.

> -#if __BSD_VISIBLE
> +#if __POSIX_VISIBLE >= 200809
>  #define        O_DIRECTORY     0x00020000      /* Fail if not directory */
>  #define        O_EXEC          0x00040000      /* Open for execute only */
>  #endif
> @@ -184,7 +184,7 @@ typedef     __pid_t         pid_t;
>  #endif
>
>  /* Defined by POSIX Extended API Set Part 2 */

See above.

> -#if __BSD_VISIBLE
> +#if __POSIX_VISIBLE >= 200809
>  /*
>   * Magic value that specify the use of the current working directory
>   * to determine the target of relative file paths in the openat() and
[...]

-- 
wbr,
pluknet


More information about the freebsd-standards mailing list