bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: openat wrapper assumes that O_RDONLY is disjoint from R_RDWR


From: Paul Eggert
Subject: Re: openat wrapper assumes that O_RDONLY is disjoint from R_RDWR
Date: Sat, 7 Mar 2020 11:05:09 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/4/20 9:24 AM, Dan Gohman wrote:
Would
    if (flags & ((O_CREAT | O_WRONLY | O_RDWR) & ~O_RDONLY))
be correct?

That would fix the problem for systems that define O_RDONLY as Hurd does,
while not breaking any known systems.

It wouldn't be correct on a hypothetical system

Thanks for mentioning this. We might as well fix the code for the hypothetical systems while we're at it, since we can use O_ACCMODE here. The issue also occurs in the 'open' wrapper. I installed the attached patch.

Attachment: 0001-open-openat-port-to-O_RDWR-O_RDONLY-0.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]