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: Bruno Haible
Subject: Re: openat wrapper assumes that O_RDONLY is disjoint from R_RDWR
Date: Wed, 04 Mar 2020 03:47:36 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-174-generic; KDE/5.18.0; x86_64; ; )

Dan Gohman wrote:
> > if (flags & (O_CREAT | O_WRONLY | O_RDWR))
> 
> However, this can erroneously return true on systems where O_RDWR shares
> bits with R_RDONLY.

Would
   if (flags & ((O_CREAT | O_WRONLY | O_RDWR) & ~O_RDONLY))
be correct?

Bruno




reply via email to

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